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

503 error with next-auth #935

Closed
2 tasks done
jeremygottfried opened this issue Mar 8, 2021 · 1 comment
Closed
2 tasks done

503 error with next-auth #935

jeremygottfried opened this issue Mar 8, 2021 · 1 comment

Comments

@jeremygottfried
Copy link

jeremygottfried commented Mar 8, 2021

Describe the bug

I am getting a 503 error with next-auth when I try to redirect to /api/auth/signin. I also get the same error if I try to load the signin page directly without a redirect.

The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.

Screen Shot 2021-03-08 at 3 56 48 PM

Code:

export async function getServerSideProps(context) {
  const session = await getSession(context);

  if (!session) {
    return {
      redirect: {
        destination: '/api/auth/signin',
        permanent: false,
      },
    }
  }
...
}

Serverless.yml:

myNextApp:
  org: myOrg
  stage: prod
  component: "@sls-next/serverless-component@1.18.0" # it is recommended you pin the latest stable version of serverless-next.js
  inputs:
    bucketName: myApp-nextjs
    region: us-east-1
    name: myApp

Actual behavior

Next-auth api endpoints are not working.

Expected behavior

I expected the app to work the same way it does locally. I redirect to a signin page generated by next-auth when the user is not logged in.

Could be related to #819 or #222

  • You have reviewed the README and FAQs, which answers several common questions.
  • Please first try 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.
@jeremygottfried
Copy link
Author

503 is gone after I upgraded next-auth, but lambdas are failing to find prisma binary, so I basically can't use this right now.

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

No branches or pull requests

1 participant