Skip to content

Amplify pull makes Lambda functions configurations and ENV to go to default

0

We have an App that uses Amplify for the backend. The same project is also used for the Admin Dashboard we've build for the app. We had some problems with the environmets and timeouts that we have set to be higher and once we pushed some changes using the cli, the values of timeout reseted. So we said we are going to modify the backend only from the App, and pull the changes in Dashboard. But as we did that today, the timeouts were again been reseted to 25 seconds. Can someone explain me why is this happening?

asked 2 years ago251 views

2 Answers
0

The issue you're experiencing with Lambda function configurations and environment variables resetting to default values after using Amplify pull is a known challenge when managing Amplify projects across different environments or codebases.

When you use Amplify pull, it synchronizes your local environment with the cloud backend. However, this process can sometimes overwrite custom configurations that were set outside of the Amplify CLI, such as manually adjusted timeout values in the AWS Console or through other means.

By default, Lambda functions in Amplify have a timeout of 3 seconds. The fact that you're seeing it reset to 25 seconds suggests that this might be a custom default set in your project's configuration files.

To prevent this issue from occurring, you have a few options:

  1. Use Amplify CLI to set the timeout: Instead of modifying the timeout in the AWS Console, use the Amplify CLI to update the function configuration. This ensures that the changes are tracked in your local Amplify configuration files.

  2. Custom resource overrides: You can create custom resource overrides in your Amplify project to specify Lambda function configurations, including timeouts. These overrides will be respected during Amplify pull operations.

  3. Use environment-specific configurations: Amplify allows you to set up different configurations for different environments (dev, prod, etc.). Ensure that you're using the correct environment when pulling changes.

  4. Version control your Amplify configuration files: Keep your Amplify configuration files (like amplify/backend/function/<function-name>/<function-name>-cloudformation-template.json) in version control. This way, you can track changes and restore custom configurations if they get overwritten.

To maintain consistency across your app and admin dashboard projects, consider using a shared Amplify backend that both projects can reference. This approach can help ensure that your Lambda function configurations remain consistent across different parts of your application.

Remember, when making changes to your backend configuration, it's crucial to communicate these changes to all team members and ensure that everyone is working with the most up-to-date backend setup.

Sources
Amplify Functions: Create serverless functions using TypeScript, powered by AWS Lambda | Front-End Web & Mobile
Troubleshooting Lambda configurations - AWS Lambda
Configure Lambda function timeout - AWS Lambda
AWS Amplify | Extensible Web & Mobile Apps | Amazon Web Services

answered 2 years ago

0

Hello,

After reviewing the above response, I would recommend you to try the above suggested solution and prevention methods. If you are still facing issues post performing the troubleshooting steps mentioned above then reach out to us via a support case and we can investigate your concern further.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.