I found out, that I can acces the index page http://localhost:3000/projects but not the same page with a trailing slash http://localhost:3000/projects/, which results in a 404.
Similar with http://localhost:3000/projects/new everything is fine, but http://localhost:3000/projects/new/ results in an error.
http://localhost:3000/projects -> works finehttp://localhost:3000/projects/ -> not foundhttp://localhost:3000/projects/new -> works finehttp://localhost:3000/projects/new/ -> error
output of `blitz --version --verbose`
Linux 4.4 | linux-x64 | Node: v14.3.0
blitz: 0.16.0 (global)
blitz: 0.16.0 (local)
There are inconsistancies across routes regarding trailing slashes. Some routes work with both versions, others not.
How should urls behave with and without trailing slashes in general?
Here is a blog post about the topic for further read: https://searchfacts.com/url-trailing-slash/
Found something next.js related here: https://stackoverflow.com/questions/57005120/how-can-you-handle-trailing-slashes-in-next-js-routes
In nextjs docs: https://nextjs.org/docs/api-reference/next.config.js/exportPathMap#adding-a-trailing-slash
Issue in nextjs repo: https://github.com/vercel/next.js/issues/5214
Thanks @donni106! I'm assuming this works fine with plain Next.js. And judging by the Prisma error, it looks like maybe there is a bug with our useParam() hook?
Someone just needs to dig into this a bit and find the root cause :)
This is possible for the error with e.g. .../projects/new/.
But for the 404 on .../projects/ I think it is something different. Have you checked the referenced issue in the nextjs repo? It is a long lasting discussion. There seems to be some difficulties also in plain nextjs.
Ok yeah I haven't dug into it. I'm currently focused on authentication, so hopefully someone else can look into this :)
Yeah I think this is a Next problem, not a Blitz problem. In this Next Sandbox, users resolves, as does users/1, but users/ returns a 404.
Update: looks like it鈥檚 being fixed! https://github.com/vercel/next.js/issues/5214#issuecomment-648213750
This has now been fixed in Next, so I鈥檓 closing this. If you see the Sandbox I linked above, I鈥檝e updated Next to the latest version, and the routes now seem to work correctly. Please feel free to open again if this problem persists!