agutoli / serverless-layers

Serverless.js plugin implementing AWS Lambda Layers, reducing lambda size, warm-up, and deployment time.
MIT License
229 stars 53 forks source link

Layer version not updated when using provision concurency #139

Open orr-levinger opened 1 year ago

orr-levinger commented 1 year ago

configuration:

  serverless-layers:
    - common:
        dependenciesPath: ./package.json
        layersDeploymentBucket: ${self:custom.base}-layers

version: "serverless-layers": "2.6.1",

lambda:

  onMessageEvent:
    handler: src/functions/events/on-message-event.handler
    timeout: 180
    provisionedConcurrency: 1

Error:

2023-04-01T15:18:32.287Z undefined ERROR Uncaught Exception { "errorType": "Runtime.ImportModuleError", "errorMessage": "Error: Cannot find module '@segment/analytics-node'\nRequire stack:\n- /var/task/src/functions/events/on-message-event.js\n- /var/runtime/index.mjs", "stack": [ "Runtime.ImportModuleError: Error: Cannot find module '@segment/analytics-node'", "Require stack:", "- /var/task/src/functions/events/on-message-event.js", "- /var/runtime/index.mjs", " at _loadUserApp (file:///var/runtime/index.mjs:996:17)", " at Object.UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1031:21)", " at start (file:///var/runtime/index.mjs:1194:23)", " at file:///var/runtime/index.mjs:1200:1" ] }

plugin output: `... ○ Downloading /package-jimp.json from bucket... ... ○ Comparing package.json dependencies... ... ○ No changes ! Using same layer arn: arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-jimp:6 ... ○ Adding layers... ... x (Skipped) function.increasePlanCounters ... x (Skipped) function.onQuestionsPutEvent ... x (Skipped) function.onFeaturesPutEvent ... ✓ function.onUsersS3PutEvent - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-jimp:6 ... x (Skipped) function.onQuestionImagePutEvent ... x (Skipped) function.onExecutionTimeReached ... x (Skipped) function.onSecondsSinceAcceptedReached ... x (Skipped) function.onSwipeEvent ... x (Skipped) function.onUserFutureEvent ... x (Skipped) function.createBots ... x (Skipped) function.onUserEvent ... x (Skipped) function.onMessageEvent ... x (Skipped) function.onQuestionEvent ... x (Skipped) function.onMatchEvent ... x (Skipped) function.postUserConfirmation ... x (Skipped) function.createAuthChallenge ... x (Skipped) function.preSignUp ... x (Skipped) function.defineAuthChallenge ... x (Skipped) function.verifyAuthChallenge ... x (Skipped) function.postAuthentication ... x (Skipped) function.getAvatars ... x (Skipped) function.getGenders ... x (Skipped) function.getUsersFacetsStats ... x (Skipped) function.getFeatures ... x (Skipped) function.updateFeatures ... x (Skipped) function.getInterests ... x (Skipped) function.updateInterests ... x (Skipped) function.deleteAllUsers ... x (Skipped) function.syncDynamoUsersWithAlgolia ... x (Skipped) function.deleteUserAnsweredQuestions ... x (Skipped) function.deleteAllAnsweredQuestions ... x (Skipped) function.getUserImagesUrls ... x (Skipped) function.getQuestionUploadUrl ... x (Skipped) function.getUploadUrl ... x (Skipped) function.getUserImages ... x (Skipped) function.deleteUserImages ... x (Skipped) function.updateSubscription ... x (Skipped) function.getMatchImagesUrls ... x (Skipped) function.rejectMatch ... x (Skipped) function.acceptMatch ... x (Skipped) function.approveMatch ... x (Skipped) function.onDelayedTaskStream ... x (Skipped) function.findMatches ... x (Skipped) function.searchUsers ... x (Skipped) function.getQuestionImage ... x (Skipped) function.respondToGame ... x (Skipped) function.requestGame ... x (Skipped) function.getUnAnsweredQuestions ... x (Skipped) function.answerQuestion ... x (Skipped) function.getSwipes ... x (Skipped) function.pushSwipes ... x (Skipped) function.getAppConfig

[ LayersPlugin ]: => common ... ○ Downloading ./package.json from bucket... ... ○ Comparing package.json dependencies... ... ○ No changes ! Using same layer arn: arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ○ Adding layers... ... ✓ function.increasePlanCounters - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onQuestionsPutEvent - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onFeaturesPutEvent - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onUsersS3PutEvent - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onQuestionImagePutEvent - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onExecutionTimeReached - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onSecondsSinceAcceptedReached - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onSwipeEvent - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onUserFutureEvent - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.createBots - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onUserEvent - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onMessageEvent - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onQuestionEvent - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onMatchEvent - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.postUserConfirmation - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.createAuthChallenge - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.preSignUp - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.defineAuthChallenge - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.verifyAuthChallenge - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.postAuthentication - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getAvatars - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getGenders - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getUsersFacetsStats - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getFeatures - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.updateFeatures - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getInterests - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.updateInterests - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.deleteAllUsers - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.syncDynamoUsersWithAlgolia - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.deleteUserAnsweredQuestions - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.deleteAllAnsweredQuestions - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getUserImagesUrls - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getQuestionUploadUrl - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getUploadUrl - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getUserImages - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.deleteUserImages - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.updateSubscription - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getMatchImagesUrls - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.rejectMatch - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.acceptMatch - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.approveMatch - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.onDelayedTaskStream - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.findMatches - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.searchUsers - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getQuestionImage - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.respondToGame - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.requestGame - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getUnAnsweredQuestions - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.answerQuestion - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getSwipes - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.pushSwipes - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-common:20 ... ✓ function.getAppConfig - arn:aws:lambda:us-east-1:*****:sls-blind-chat-staging-stack-nodejs-common:20

[ LayersPlugin ]: => dialogflow ... ○ Downloading /package-dialogflow.json from bucket... ... ○ Comparing package.json dependencies... ... ○ No changes ! Using same layer arn: arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-dialogflow:6 ... ○ Adding layers... ... x (Skipped) function.increasePlanCounters ... x (Skipped) function.onQuestionsPutEvent ... x (Skipped) function.onFeaturesPutEvent ... x (Skipped) function.onUsersS3PutEvent ... x (Skipped) function.onQuestionImagePutEvent ... x (Skipped) function.onExecutionTimeReached ... x (Skipped) function.onSecondsSinceAcceptedReached ... x (Skipped) function.onSwipeEvent ... x (Skipped) function.onUserFutureEvent ... x (Skipped) function.createBots ... x (Skipped) function.onUserEvent ... ✓ function.onMessageEvent - arn:aws:lambda:us-east-1::sls-blind-chat-staging-stack-nodejs-dialogflow:6 ... x (Skipped) function.onQuestionEvent ... x (Skipped) function.onMatchEvent ... x (Skipped) function.postUserConfirmation ... x (Skipped) function.createAuthChallenge ... x (Skipped) function.preSignUp ... x (Skipped) function.defineAuthChallenge ... x (Skipped) function.verifyAuthChallenge ... x (Skipped) function.postAuthentication ... x (Skipped) function.getAvatars ... x (Skipped) function.getGenders ... x (Skipped) function.getUsersFacetsStats ... x (Skipped) function.getFeatures ... x (Skipped) function.updateFeatures ... x (Skipped) function.getInterests ... x (Skipped) function.updateInterests ... x (Skipped) function.deleteAllUsers ... x (Skipped) function.syncDynamoUsersWithAlgolia ... x (Skipped) function.deleteUserAnsweredQuestions ... x (Skipped) function.deleteAllAnsweredQuestions ... x (Skipped) function.getUserImagesUrls ... x (Skipped) function.getQuestionUploadUrl ... x (Skipped) function.getUploadUrl ... x (Skipped) function.getUserImages ... x (Skipped) function.deleteUserImages ... x (Skipped) function.updateSubscription ... x (Skipped) function.getMatchImagesUrls ... x (Skipped) function.rejectMatch ... x (Skipped) function.acceptMatch ... x (Skipped) function.approveMatch ... x (Skipped) function.onDelayedTaskStream ... x (Skipped) function.findMatches ... x (Skipped) function.searchUsers ... x (Skipped) function.getQuestionImage ... x (Skipped) function.respondToGame ... x (Skipped) function.requestGame ... x (Skipped) function.getUnAnsweredQuestions ... x (Skipped) function.answerQuestion ... x (Skipped) function.getSwipes ... x (Skipped) function.pushSwipes ... x (Skipped) function.getAppConfig `

that after i added the "@segment/analytics-node": "^1.0.0-beta.24",

and the its ignored..

MattyChance commented 1 month ago

Hey! Just wondering if you have by passed this issue? i am coming across similar but not exactly issue like your.

For your issue, i think this could be more related to how you are bundling your npm modules. If you are using webpack, what's your webpack config looking like? if you are using webpack-serverlss, have you tried:

custom:
    webpack:
        includeModules:
            forceInclude:
                - analytics-node