Closed vincent38wargnier closed 7 months ago
Hey everyone -- we've examined app performance across the board and don't see holistic issues that would contribute to slow starts/time to first byte. There are many factors at play and it is more effective to examine each app on a case by case basis to identify potential issues. If you are still experiencing this issue, please open a AWS Support case or ask in our Community Discord server
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication, GraphQL API, Storage
Amplify Categories
auth, storage, function, api, hosting
Environment information
Describe the bug
Hi, I have created an AWS Amplify Web app with NextJs SSR. Everything works fine except one huge issue : cold start takes up to 7 seconds to have server response.
I realized that if I remove all my amplify backend, the cold start drops down to less than a second. So I guess the problem comes from the AWS Amplify libraries.
I deployed a version of my website that doesn't call any getServerSideProps, but the latency stays around 7 seconds.
This is my amplify backend configuration :
Here is the way my NexJs App is initialized with amplify :
I read on several forums that Amplify is not able to provide law latency cold start, so I better move to Vercel or Netlify (which I tried and works super well) for example. Can you please confirm the opposite? Sources : https://www.reddit.com/r/nextjs/comments/uamqbl/beware_of_nextjs_on_aws_amplify/
I also found some other solutions like keeping the lambda warm with a cron job. Is that a good idea? https://www.reddit.com/r/nextjs/comments/ml4i2t/ssr_pages_cold_start_improve_performance/
Thank you.
Expected behavior
I would like to have cold start no longer than 1 second, as it is on most of other cloud providers.
Reproduction steps
amplify init amplify add auth amplify add api amplify add storage amplify add function amplify add hosting amplify push
Code Snippet
Log output
aws-exports.js
/ eslint-disable / // WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.
const awsmobile = { "aws_project_region": "eu-west-2", "aws_cognito_identity_pool_id": "eu-west-2:xxxxxxxxxxxxxxx", "aws_cognito_region": "eu-west-2", "aws_user_pools_id": "eu-west-2_xxxxxxxxxxxxxxx", "aws_user_pools_web_client_id": "xxxxxxxxxxxxxxx", "oauth": {}, "aws_cognito_username_attributes": [ "EMAIL" ], "aws_cognito_social_providers": [], "aws_cognito_signup_attributes": [ "EMAIL" ], "aws_cognito_mfa_configuration": "OFF", "aws_cognito_mfa_types": [ "SMS" ], "aws_cognito_password_protection_settings": { "passwordPolicyMinLength": 8, "passwordPolicyCharacters": [] }, "aws_cognito_verification_mechanisms": [ "EMAIL" ], "aws_appsync_graphqlEndpoint": "https://xxxxxxxxxxxxxxx.amazonaws.com/graphql", "aws_appsync_region": "eu-west-2", "aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS", "aws_appsync_apiKey": "xxxxxxxxxxxxxxx", "aws_user_files_s3_bucket": "xxxxxxxxxxxxxxx", "aws_user_files_s3_bucket_region": "eu-west-2" };
export default awsmobile;
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response