Error 503 because of timeout when accessing an API endpoint twice in useEffect in 2 different pages
#1697 opened on Sep 16, 2021
Description
Issue Summary
When using next js, you can't call different api endpoints from react's useEffect hook in two different pages without a full reload. It results in a 503 error while the actual API endpoint works perfectly fine.
Actual behavior
Using next/link or next/react router to switch to another page results in subsequent api calls (made using axis) in the useEffect hook to fail after 10s of loading with a 503 error, when the API endpoint and the actual page work fine after a reload of the browser. The error in cloud watch is: Task timed out after 10.01 seconds
Expected behavior
Being able to make api calls in useEffect hooks after page switching.
Steps to reproduce
Create a new repo with latest next-auth beta version and make an api endpoint protected by their server side session utility. Try to access this endpoint in two different pages using axios.get(), with the second page accessed via a link.
Screenshots/Code/Configuration/Logs
serverless.yml:
component: "@sls-next/serverless-component@3.4.0-alpha.8"
Versions
- OS/Environment: macOS 12 Monterey Beta (Apple M1)
- @sls-next/serverless-component version: 3.4.0-alpha.8
- Next.js version: 11.1.2
Additional context
Checklist
- You have reviewed the README and FAQs, which answers several common questions.
- You have reviewed our DEBUGGING wiki and have tried your best to include complete information and reproduction steps (including your configuration) as is possible.
- You have first tried using the most recent
latestoralpha@sls-next/serverless-componentrelease version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the oldserverless-next.jscomponent and theserverless-next.jsplugin are deprecated and no longer maintained.