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

Implement 'disposeContext' option in Configuration and EsbuildFunctionDefinitionHandler #515

Merged
merged 3 commits into from
Dec 18, 2023

Conversation

0gebey
Copy link
Contributor

@0gebey 0gebey commented Dec 13, 2023

Description:

This pull request addresses the issue explained in #514. We identified a challenge regarding the handling of context disposal in the serverless-esbuild plugin, which caused error and changed behavior of Lambda functions on every 3rd local invoke.

Changes Made:

New 'disposeContext' Property: I introduced a new property named disposeContext which has a default value as 'true' in both Configuration and EsbuildFunctionDefinitionHandler interfaces. This property allows users to control whether the disposeContexts() function should dispose of the context.

Configuration Flexibility: The disposeContext option can be set globally within the esbuild configuration in the serverless configuration file. This global setting applies to all Lambda functions utilizing the specific configuration.
Function-Level Override: Individual functions can override the global setting by including the disposeContext property in their own configurations.

Backward Compatibility: Careful consideration has been given to ensure backward compatibility with these changes. For existing users of the serverless-esbuild library who have not specified the disposeContext option in their configurations, there will be no disruption in functionality. This is because the disposeContext property is set to a default value of 'true'. Consequently, the context disposal behavior will continue to operate as it did previously, maintaining the expected behavior for current users. This approach ensures a seamless transition for users updating to the version of the library that includes these new changes.

Testing: The testing for these changes was conducted within our own development environment, specifically tailored to our use case of programmatically invoking Lambda functions locally.

Impact of Changes:

This enhancement provides greater control over context management in Lambda functions, potentially improving performance and resource management for users of the serverless-esbuild plugin. It offers both a global and a function-specific configuration approach, catering to diverse use cases and deployment strategies.

I believe this feature can solve the problem of the ones who were facing with the same error and am looking forward to feedback from the maintainers and community.

@floydspace
Copy link
Owner

hi @0gebey thank you for the detailed explanation of the issue you are facing, and the PR.
could you please also update the readme with a little explanation and default value, as you are adding a new configuration option.

@floydspace
Copy link
Owner

@0gebey could you please also rebase your branch, I fixed the recent e2e tests issue, blocking PRs

@0gebey 0gebey force-pushed the hotfix/bug-in-release-1.48.1 branch from ee88f9a to 09f6a02 Compare December 18, 2023 10:41
@0gebey
Copy link
Contributor Author

0gebey commented Dec 18, 2023

@0gebey could you please also rebase your branch, I fixed the recent e2e tests issue, blocking PRs

@floydspace Can you check it again ? I believe it should be okey right now.

@floydspace floydspace merged commit fb41719 into floydspace:master Dec 18, 2023
3 checks passed
Copy link

🎉 This PR is included in version 1.50.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants