Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Install steps produce failing lambda #2

Closed
steveparker-optimise opened this issue May 20, 2016 · 7 comments
Closed

Install steps produce failing lambda #2

steveparker-optimise opened this issue May 20, 2016 · 7 comments
Assignees

Comments

@steveparker-optimise
Copy link

I followed the install instructions and that attached dist.zip was produced. This however fails on run with the following:

"errorMessage": "Cannot find module 'winston'",

dist.zip

@tmitchel2
Copy link
Member

Hi Steve,

Are you running locally using npm run start or running on aws lambda?

When you run locally it will use the dist folder not the actual packaged zip. Double check the Winston folder is there under dist/node_modules/winston.

If it is there then I think the directory you are running the npm run start from is not what I expect it to be which is the dynamodb-lambda-autoscale root folder. Please see line 4 of /scripts/start.js to understand why the starting folder is expected to be the root one.

@steveparker-optimise
Copy link
Author

Sorry should have been clearer. I'm only running it on AWS. My exact steps were:

Clone repo
CD to root directory
npm install
npm run build
upload dist.zip as a new function (with described role)

@tmitchel2
Copy link
Member

Let me take a look tonight once I get back to my mac.

@tmitchel2
Copy link
Member

tmitchel2 commented May 20, 2016

I think it's the permissions that have been set on your node_modules folder. When I download and extract the zip onto my mac I can't even cd into the node_modules folder to see its content. I presume aws lambda is having the same issue. Im not sure why this would be the case, perhaps something todo with your default permissions? Even if you can access the folder it might be that all other users cant..

Im contemplating removing the only node_module dependency (winston) anyway.

@tmitchel2 tmitchel2 self-assigned this May 21, 2016
@brendonparker
Copy link

I also had some challenge getting this working when running locally using npm start run. Best I can tell, the dotenv package is failing to set the aws access keys. When I debug, it looks like any attempt to set process.env properties at run-time does nothing (doesn't throw an exception, but also doesn't set the value).

I'm running on Windows - don't know if that is to blame.

I was able to get it to work if I added the access keys to the package.json start script command.

@tmitchel2
Copy link
Member

I think your issue is slightly different, I haven't tested windows compatibility. It looks related to motdotla/dotenv#83 and I've opened another issue to cover windows compatibility here #3

@tmitchel2
Copy link
Member

I just made a commit 357123d which removes all node_modules (i.e. winston) and changes the .env file to config.env. This should sort both your issues. Please let me know if you still get issues though as I haven't been able to test this on a windows machine.

mcinteer added a commit to mcinteer/dynamodb-lambda-autoscale that referenced this issue Jun 28, 2016
Get the table names correctly
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants