Skip to content

feat(zip-it-and-ship-it): feature flag ability to dynamically import funcion inside request handler #6248

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

Merged
merged 3 commits into from
May 7, 2025

Conversation

JakeChampion
Copy link
Contributor

depends on https://github.com/netlify/serverless-functions-api/pull/385

this gives us the ability to catch any errors which may arise when importing the function's code, and also allows us to prepare more within the bootstrapping phase before the functions code is executed - such as populating process.env or any bootstrapping that may require information provided by Proxy for the invocation

…funcion inside request handler

this gives us the ability to catch any errors which may arise when importing the function's code,
and also allows us to prepare more within the bootstrapping phase before the functions code is
executed - such as populating process.env or any bootstrapping that may require information
provided by Proxy for the invocation
@JakeChampion JakeChampion marked this pull request as ready for review May 7, 2025 13:45
@JakeChampion JakeChampion requested a review from a team as a code owner May 7, 2025 13:45
Comment on lines +56 to +57
`import * as bootstrap from './${BOOTSTRAP_FILE_NAME}'`,
`export const handler = bootstrap.getLambdaHandler('${importPath}')`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation changes the signature of bootstrap.getLambdaHandler() from accepting a module object to accepting a path string. Make sure the corresponding implementation in the bootstrap file has been updated to handle this new signature, otherwise this will cause runtime errors.

@JakeChampion JakeChampion merged commit 63a89a5 into main May 7, 2025
34 checks passed
@JakeChampion JakeChampion deleted the jake/dynamic-function-import branch May 7, 2025 20:15
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

Successfully merging this pull request may close these issues.

2 participants