Hello, I created a blank project and the repo was created by Plasmic Bot using Publish button. After I created a new branch and relinked the repo again (set to push changes to another branch, instead of main), when I’m trying to deploy it to Vercel I’m getting this error.
Error: You cannot define a route with the same specificity as a optional catch-all route ("/" and "/[[...catchall]]").
Hi @brief_warbler,
This usually happens when we accidentally mixup the codegen approach with loader API. Please try deleting index.ts file and it should work.
The / route will then be handled by the loader API within th catchall.
Thank you, I will try now. One more thing, when I created the project the Mode was Loader and when I relinked the repo the mode was Codegen and I wasn’t allowed to change it.
Yeah, I observed the exact same behavior in one of my previous projects. It can be further clarified by the Plasmic team if it’s expected behavior or not.
To stick with a particular approach we can manually cleanup the files accordingly.
For CodeGen
Remove plasmic-init.ts
Remove catchall
Retain plasmic.json
Execute plasmic sync command to resync everything in codegen.
Repeat step 4 for upcoming changes
For Loader API
Remove plasmic.json
Remove index.ts
Remove any other page that might get synced due to codegen.
Retain catchall, so it can utilize the loader API and display components/pages accordingly
Inside plasmic-init.ts, you can use preview:true in development mode to fetch latest changes during development.
I’m having the same problem but cannot fix it using your method. Below is the error I’m getting when trying to deploy on Vercel.
Can you assist me? Thanks in advance.
[17:10:06.265] > Build error occurred
[17:10:06.268] Error: You cannot define a route with the same specificity as a optional catch-all route ("/" and "/[[...catchall]]").
[17:10:06.268] at UrlNode._smoosh (/vercel/path0/node_modules/next/dist/shared/lib/router/utils/sorted-routes.js:42:23)
[17:10:06.268] at UrlNode.smoosh (/vercel/path0/node_modules/next/dist/shared/lib/router/utils/sorted-routes.js:16:21)
[17:10:06.268] at getSortedRoutes (/vercel/path0/node_modules/next/dist/shared/lib/router/utils/sorted-routes.js:167:17)
[17:10:06.268] at /vercel/path0/node_modules/next/dist/build/index.js:623:65
[17:10:06.268] at Span.traceFn (/vercel/path0/node_modules/next/dist/trace/trace.js:147:20)
[17:10:06.268] at /vercel/path0/node_modules/next/dist/build/index.js:622:89
[17:10:06.268] at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/trace/trace.js:154:20)
[17:10:06.270] at async build (/vercel/path0/node_modules/next/dist/build/index.js:366:9)
[17:10:06.298] Error: Command "npm run build" exited with 1