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

Incremental Static Regeneration Not working when lambda handler is added #2493

Open
HemeanandhB opened this issue Oct 6, 2022 · 0 comments

Comments

@HemeanandhB
Copy link

I am trying to use custom handler in my application to forward Cloudfront headers back to browser. I have the following code in serverless.json

"inputs": { "handler": "handler.handler",............}.
I have a file named handler.js in codebase and it exports method named handler. It has the logic to forward the CloudFront headers.

Custom handler gets added only for default & Api lambdas. The logic written in handler works. But ISR stopped working from then. I could see the following error for Regeneration lambda in cloudwatch. This gets logged frequently after adding handler:
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module 'handler'\nRequire stack:\n- /var/runtime/index.mjs",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module 'handler'",
"Require stack:",
"- /var/runtime/index.mjs",
" at _loadUserApp (file:///var/runtime/index.mjs:951:17)",
" at async Object.UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:976:21)",
" at async start (file:///var/runtime/index.mjs:1137:23)",
" at async file:///var/runtime/index.mjs:1143:1"
]
}

This makes ISR to fail which is concern for my application. Is there an option to add handlers only for default lambda alone, or could we add handlers with out affecting Incremental Static Regeneration

Please advice

Thanks in advance.

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

No branches or pull requests

1 participant