Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Error 503 because of timeout when accessing an API endpoint twice in useEffect in 2 different pages #1697

@Kakise

Description

@Kakise

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/[email protected]"

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 latest or alpha @sls-next/serverless-component release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the old serverless-next.js component and the serverless-next.js plugin are deprecated and no longer maintained.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions