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

Since custom handlers are not copied to the regeneration lambda, use the default handler and ignore the customer handler when building the regeneration lambda #2484

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rsanchez
Copy link

When you use a custom handler option (mine is handler.js, so my config is handler.handler), the custom handler file gets copied to the default lambda and the image lambda, but not the regeneration lambda. However, the regeneration lambda still attempts to load the customer handler named in the options, and since that custom handler is not copied over, the regeneration lambda fails. This is the error I see:

{
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module 'handler'\nRequire stack:\n- /var/runtime/UserFunction.js\n- /var/runtime/Runtime.js\n- /var/runtime/index.js",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module 'handler'",
        "Require stack:",
        "- /var/runtime/UserFunction.js",
        "- /var/runtime/Runtime.js",
        "- /var/runtime/index.js",
        "    at _loadUserApp (/var/runtime/UserFunction.js:221:13)",
        "    at Object.module.exports.load (/var/runtime/UserFunction.js:279:17)",
        "    at Object.<anonymous> (/var/runtime/index.js:43:34)",
        "    at Module._compile (internal/modules/cjs/loader.js:1085:14)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
        "    at Module.load (internal/modules/cjs/loader.js:950:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
        "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)",
        "    at internal/main/run_main_module.js:17:47"
    ]
}

Here's another person experiencing the same issue:
#1098 (comment)

This PR use the default handler name and ignores the custom handler when building the regeneration lambda.

…the default handler and ignore the customer handler when building the regeneration lambda
@slsnextbot
Copy link
Collaborator

Handler Size Report

No changes to handler sizes.

Base Handler Sizes (kB) (commit e6367b5)

{
    "Lambda": {
        "Default Lambda": {
            "Standard": 1578,
            "Minified": 692
        },
        "Image Lambda": {
            "Standard": 1543,
            "Minified": 831
        }
    },
    "Lambda@Edge": {
        "Default Lambda": {
            "Standard": 1588,
            "Minified": 698
        },
        "Default Lambda V2": {
            "Standard": 1580,
            "Minified": 694
        },
        "API Lambda": {
            "Standard": 634,
            "Minified": 318
        },
        "Image Lambda": {
            "Standard": 1551,
            "Minified": 835
        },
        "Regeneration Lambda": {
            "Standard": 1233,
            "Minified": 566
        },
        "Regeneration Lambda V2": {
            "Standard": 1307,
            "Minified": 596
        }
    }
}

New Handler Sizes (kB) (commit f294076)

{
    "Lambda": {
        "Default Lambda": {
            "Standard": 1578,
            "Minified": 692
        },
        "Image Lambda": {
            "Standard": 1543,
            "Minified": 831
        }
    },
    "Lambda@Edge": {
        "Default Lambda": {
            "Standard": 1588,
            "Minified": 698
        },
        "Default Lambda V2": {
            "Standard": 1580,
            "Minified": 694
        },
        "API Lambda": {
            "Standard": 634,
            "Minified": 318
        },
        "Image Lambda": {
            "Standard": 1551,
            "Minified": 835
        },
        "Regeneration Lambda": {
            "Standard": 1233,
            "Minified": 566
        },
        "Regeneration Lambda V2": {
            "Standard": 1307,
            "Minified": 596
        }
    }
}

@codecov
Copy link

codecov bot commented Aug 26, 2022

Codecov Report

Merging #2484 (f294076) into master (e6367b5) will increase coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2484      +/-   ##
==========================================
+ Coverage   83.85%   83.88%   +0.02%     
==========================================
  Files         102      102              
  Lines        3717     3716       -1     
  Branches     1191     1190       -1     
==========================================
  Hits         3117     3117              
+ Misses        588      587       -1     
  Partials       12       12              
Impacted Files Coverage Δ
...rless-components/nextjs-component/src/component.ts 86.31% <ø> (-0.05%) ⬇️
packages/libs/core/src/images/imageOptimizer.ts 84.51% <0.00%> (+0.41%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@rsanchez
Copy link
Author

@telmperez does this error message relate to the issue you reported?

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