Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic routing broken with AWS API Gateway #7625

Closed
aaronhuisinga opened this issue Jun 27, 2020 · 3 comments · Fixed by #7639
Closed

Dynamic routing broken with AWS API Gateway #7625

aaronhuisinga opened this issue Jun 27, 2020 · 3 comments · Fixed by #7639

Comments

@aaronhuisinga
Copy link

aaronhuisinga commented Jun 27, 2020

Version

v2.13.2

Reproduction link

(Not possible without AWS setup using API Gateway)

Steps to reproduce

  1. Setup Nuxt app running behind AWS API Gateway
  2. Create dynamic route
  3. 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.

This bug report is available on Nuxt community (#c10860)
@ghost ghost added the cmty:bug-report label Jun 27, 2020
@cmorbitzer
Copy link

Also experiencing this issue. Seems to be introduced by #7603

@pi0
Copy link
Member

pi0 commented Jun 30, 2020

Hi! Should be fixed by #7639 (you can early test using nuxt-edge)

@pi0 pi0 mentioned this issue Jun 30, 2020
@aaronhuisinga
Copy link
Author

Thanks @pi0! I can confirm this PR fixes the issue. Just tested using nuxt-edge and routing works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants