0

In creating a new function, I have zipped up the index.js and node_modules that I need for the project. The modules include the alexa-sdk and twilio. My index.js has an export.handler function.

Two questions

1) Do I have to have a package.json file in the upload?
2) Does the upload file name have to match the configuration handler?

After the upload I cannot use the inline code editor to work on the index.js file, it says it is too large.

4
  • What problem are you experiencing exactly... that your file is too large to edit? Commented Aug 7, 2017 at 20:06
  • That is correct but the index.js file is rather small , in fact I used it in other skills that I have live and running. My biggest issue is that I am doing an upgrade of a skill I have running but need the twilio sdk for the new features I want to add. Commented Aug 7, 2017 at 20:20
  • The deployment package of your Lambda function "MedTimeII" is too large to enable inline code editing. However, you can still invoke your function right now Commented Aug 7, 2017 at 20:53
  • Additionally, you don't even have to include node_modules/aws-sdk, as lambda will use it's own version anyway. This saves about 5MB zipped. This is my go to zip command: zip -r ../skill.zip * --exclude '*.DS_Store*' '*.git*' '*.vscode*' 'node_modules/aws-sdk/*' Commented Aug 24, 2018 at 13:30

3 Answers 3

1
  1. The zip filename does not change the lambda behavior.
  2. Lambda console will use the code in (filename.handler_function) to call your lambda. In this case your handler should be index.handler.

If you want to speed up your import/edit/upload lambda functions you can use a cli tool like lambda-toolkit.

Sign up to request clarification or add additional context in comments.

1 Comment

Correct I am using the index.handler , what I expected to see was my index.js file in the inline code editor and then be able to call functions from the twilio library. my index.js file is only 20kb
0
  1. No, As long as you've installed the node_modules like the alexa-sdk you don't need package.json.

  2. Lambda will use index.js.

  3. It would be nice to edit index.js in the inline code editor. Unfortunately that's not an available option. Instead each time you edit your code you'll need to re-zip and re-upload. Also the name doesn't matter. I name mine foo.zip.

2 Comments

thanks for the follow up and you are right , just unfortunate that they have not re-worked the create function to show the index.js file after the upload
apparently it has been said that once doing an upload you cannot use the inline code editor. I decided to just check and test a download of the files I uploaded and made all the changes necessary using vscode, uploaded and all the modules are loaded and the application works. You just cant use the inline editor for quick changes and test . you will need to upload each time you make a change to you js file
0

You don't have to include package.json in the zip file for upload.

If your uploaded zip file exceeds 3MB, you wont be able to use the inline code editor.

If the size of your Lambda function's zipped deployment packages exceeds 3MB, you will not be able to use the inline code editing feature in the Lambda console. You can still use the console to invoke your Lambda function.

More on AWS Lambda limits here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.