503 Error on api call with Apollo Server "The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions."
See original GitHub issueI’m deploying an application using the @sls-next/serverless-component plugin. I built out an api route with an Apollo Server, specifically “apollo-server-micro” because this is what’s suggested by other Next.js users. All my other api routes work, but I can’t access this one in production mode which you can see on my actual site at https://sekndapp.com/api/createNewUser. This is what my createNewUser.ts file looks like.
import { ApolloServer, gql } from "apollo-server-micro";
export const config = {
api: {
bodyParser: false,
},
};
const apolloServer: ApolloServer = new ApolloServer({ typeDefs, resolvers });
const handler = apolloServer.createHandler({ path: `/api/createNewUser` });
export default handler;
And my serverless.yml file.
myNextApplication:
component: "@sls-next/serverless-component@1.17.0"
inputs:
domain: "sekndapp.com"
timeout: 30
name:
defaultLambda: resourceAPILambda
apiLambda: resourceAPILambda2
I’m also having issues where I can’t see logs from my lambda functions in lambda. Is there a way to fix this or should I go with another way to deploy to AWS?
Issue Analytics
- State:
- Created 3 years ago
- Comments:19
Top Results From Across the Web
503 ERROR The request could not be satisfied (AWS Amplify)
The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions. We can't connect to the ...
Read more >Cloudfront 503 Error on api route call with Apollo Server and ...
When I run build Serverless seems to create a lambda function for my Apollo Server handler, but I don't know where to look...
Read more >HTTP 503 status code (Service Unavailable)
An HTTP 503 status code (Service Unavailable) typically indicates a performance issue on the origin server. In rare cases, it indicates that CloudFront ......
Read more >Deploying with AWS Lambda - Apollo GraphQL Docs
In this guide, we'll walk through how to deploy Apollo Server's AWS Lambda integration to AWS Lambda using the Serverless framework.
Read more >CloudFront with Lambda@Edge: 503 The request could not ...
Here is the erorr message The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions. ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Will need more logs, please check here on how to get logs: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-testing-debugging.html on how to get logs for Lambda@Edge - they are in the region closest to the viewer which is not necessarily in us-east-1 (where the Lambda is created in).
Yea @dphang @zerbinidamata @grantmontgomery I’m quite sure now that this isn’t an issue with the serverless-next plugin, but rather something within our own implementations.
I’ve just deployed this apollo client/ server example from next that also has API routes and it works flawlessly, also on API Routes. https://github.com/vercel/next.js/tree/canary/examples/api-routes-apollo-server-and-client Going to look into my setup later and compare with that example