Framework Upgrade: Private route doesn't work

Hello,

My app, vida, has been outdated for a while. I’m upgrading my redwoodjs app from v0.21. So far, I got to v0.30. I’m facing an issue with Private routes. The app doesn’t navigate when I click on the link. It shows an empty page. When I remove the Private tag, routing works.

I use Auth0 for authentication. I checked the latest docs and the example-blog app. So far, I haven’t found the issue. Did anyone run into this problem before? What’s the way to debug route navigation issues?

Thanks.

There have been a few changes/fixes to the <Private> stuff and routing in general over the last bunch of releases. So I’d recommend continuing with the upgrade process and then see if you still have the issue when you’re on the latest version of RW. Specifically for auth0 we’ve changed how redirects after login are handled. Not sure if that would affect you or not, but either way I’d recommend continuing on with the version-by-version upgrade process.

2 Likes

Thanks for the tip @Tobbe. I’ll continue the upgrade and report back.

I upgraded my app to v0.35. The routing issue went away. It’s correctly routing now. But I’m facing a new issue with deployment. I deploy to vercel.

17:10:10.763 $ /vercel/path1/node_modules/.bin/prisma generate --schema=/vercel/path1/api/db/schema.prisma
17:10:11.891 Prisma schema loaded from db/schema.prisma
17:10:12.371 Error: Unexpected token r in JSON at position 0
17:10:12.388 error Command failed with exit code 1.

I ran the command locally and also got this error.

Hi @dnprock when you say “ran the command locally”, what was the command?

yarn rw prisma generate ?

@dthyresson I run this command:

./node_modules/.bin/prisma generate --schema=./api/db/schema.prisma

So, that’s not typically how one runs Redwood CLI commands.

What happens when you run:

yarn rw prisma generate 

And also make sure that redwood.toml has the correct path to your db schema – if you are setting it (you don’t need to if it is in the default location).

See Docs - App Configuration: redwood.toml : RedwoodJS Docs for the settings.

Thanks for the suggestion. I got the same error running yarn rw prisma generate. The command runs ./prisma --generate internally.

I found that I need to change binaryTargets field. It used to reference BINARY_TARGET environment variable. Now it’s just “native”.

I finished upgrading to 0.35 now. Yay!

1 Like