Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

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

Open
@HemeanandhB

Description

@HemeanandhB

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions