-
Notifications
You must be signed in to change notification settings - Fork 121
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
basePath does not works as expected with API routes #522
Comments
It should be a pretty easy fix, we probably just need to append the basePath if necessary here |
@conico974, I assume no one is working on this. I'll raise a PR. |
socsieng
added a commit
to socsieng/open-next
that referenced
this issue
Sep 23, 2024
socsieng
added a commit
to socsieng/open-next
that referenced
this issue
Sep 23, 2024
socsieng
changed the title
basePath is does not works as expected with API routes
basePath does not works as expected with API routes
Oct 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue
NextJS app deployed using SST and OpenNext does not respect
basePath
property defined in NextJS config for API routes.I'd love to work on this but unfortunately I don't know where to start.
Potentially related to: #508
Environment
Reproduction steps
Clone repository at https://github.com/socsieng/next-sst which includes detailed reproduction steps. Reproduction steps also included inline.
1.
create-next-app
and initialize SSTnpx create-next-app@latest next-sst cd next-sst sst init
2. Update the
next.config.mjs
file to include thebasePath
3. Add an API route at
app/api/hello/route.ts
4. Use latest version of
ope-next
insst.config.ts
3.1.3
at the time of writing.5. Deploy the app
6. Open the following URLs in the browser
Replace
assignedhost
with the actual CloudFront distribution URL.Expected results
Both 6.1 and 6.2 return successful responses.
Actual results
6.1 returns a successful response, but 6.2 returns a 404 error. Note that changing the URL for 6.2 to exclude the
basePath
(https://assignedhost.cloudfront.net/api/hello) works.Note that this works as expected with
sst dev
:The text was updated successfully, but these errors were encountered: