-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Version
Reproduction link
(Not possible without AWS setup using API Gateway)
Steps to reproduce
- Setup Nuxt app running behind AWS API Gateway
- Create dynamic route
- Click link to dynamic route
What is expected ?
Router navigates to page defined in dynamic route
What is actually happening?
400 error when trying to fetch /_nuxt/pages/resource/[_]id.js
Additional comments?
AWS API Gateway does not allow square brackets "[" and "]" in URLs. Nuxt uses these square brackets in the file names for the compiled JS for dynamic routes. Any time that a request is made to load this file, API Gateway returns a 400 error. The recommended fix for this is encoding the URL before making the request, which is what Next.js did to fix this same issue (vercel/next.js#8013). Another possible fix could be adding a configuration option for changing the name of the generated files for dynamic routes, and giving users the ability to replace the square brackets with something else.