claudiajs / claudia

Deploy Node.js projects to AWS Lambda and API Gateway easily
https://claudiajs.com
MIT License
3.8k stars 276 forks source link

having trouble with claudia pack #203

Closed ispyinternet closed 4 years ago

ispyinternet commented 5 years ago

First time trying to use this on a project.

running claudia pack --no-optional-dependencies --output lambda.zip --force

trying to overcome the issues of symlinks coming from file:../ style dependencies.

I also have some git+ssh://git@bitbucket... dependencies.

The error appears to come from one of the git+ssh dependencies within one of the file:.. dependences:

after a few successful lines of processing we get to:

packaging files npm install -q --no-audit --production
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@xxx.zz/package.git
npm ERR! 
npm ERR! fatal: not a git repository: /tmp/ARBNcc/lambda-1.0.0-GgGquz/package/../../../.git/modules/Project/Lambda/example_function
npm ERR! 
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /zzzz/tmp/.npm/_logs/2019-09-05T18_23_29_088Z-debug.log
npm install -q --no-audit --production failed.
ispyinternet commented 5 years ago

Interestingly, the example_lambda folder was a git submodule. When I removed the .git folder it looks like it works!? I have a zip, going to test now.

ispyinternet commented 5 years ago

before closing this one, is there something that needs to be looked at? having .git in the same folder as package.json perhaps with some other factors combined causes a fault?

gojko commented 5 years ago

sorry I thought you solved the issue, misread the first comment. so having a git dependency inside a local dependency causes the problem? can you paste your package.json from the problematic dependency here, so I can try to reproduce?

ispyinternet commented 5 years ago

My lambda package.json has a git dependency and a file dependency - the dependency referenced by the file also has a git dependency within it. The lambda itself has a .git folder in the same folder as package.json. This is actually a submodule in a bigger git project. Claudia will only work if I remove the .git folder within the lambda.

gojko commented 5 years ago

so is the .git folder the problem, or the git dependency? I tried both now locally and they seem fine to me. we use npm pack to package things, so perhaps there is a bug in npm, or some inconsistency between npm versions we use for testing and the one you use locally. if possible, please:

so I can reproduce the problem here and try to fix it. if pasting package.json is not possible, can you perhaps create a minimal example that demonstrates the issue and upload it.

ispyinternet commented 5 years ago

If you could give me a bit of time I will get to this. Cheers

gojko commented 4 years ago

closing this due to inactivity

jratiwanich commented 3 years ago

I have the same problem. I'm using Node v15.3.0 Has anyone figured out how to fix this?

`$ claudia update --runtime nodejs12.x --config claudia.dev.json --version development --timeout 120 packaging files npm install -q --no-audit --production npm ERR! code 1 npm ERR! git dep preparation failed npm ERR! command /Users/xxxx/.nvm/versions/node/v15.3.0/bin/node /Users/xxx/.nvm/versions/node/v15.3.0/lib/node_modules/npm/bin/npm-cli.js install --cache=/Users/xxx/.npm/_cacache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit npm ERR! > @types/ramda@0.25.0 prepublish npm ERR! > yarn run build npm ERR! npm ERR! yarn run v1.22.10 npm ERR! $ gulp build npm ERR! info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. npm ERR! [09:27:03] Local gulp not found in ~/.npm/_cacache/tmp/git-clone-6910dc7d npm ERR! [09:27:03] Try running: npm install gulp npm ERR! error Command failed with exit code 1. npm ERR! npm ERR! code 1 npm ERR! npm ERR! path /Users/xxx/.npm/_cacache/tmp/git-clone-6910dc7d npm ERR! npm ERR! command failed npm ERR! npm ERR! command sh -c yarn run build npm ERR! npm ERR! npm ERR! A complete log of this run can be found in: npm ERR! npm ERR! /Users/xxx/.npm/_cacache/_logs/2020-12-06T17_27_03_349Z-debug.log

npm ERR! A complete log of this run can be found in: npm ERR! /Users/xxx/.npm/_logs/2020-12-06T17_27_03_467Z-debug.log npm install -q --no-audit --production failed. `

JustFly1984 commented 3 years ago

You are running claudiajs in node 15.3 environment, trying to pack lambda for node 12. There is a chance that you have installed npm packages for previous node versions. Also an error states that there is 'gulp' package missing.

JustFly1984 commented 3 years ago

Also you are running with --production flag, which ignores devDependencies. I guess gulp is incorrectly installed to devDependencies, but required as dependency in the code

jratiwanich commented 3 years ago

The only command I ran was the claudia command line. After the first line, claudia shows the log of what's it doing. I guess claudia is trying to pack some files and throws an error related to gulp.

I got it working now by swiching my npm to lower version i.e. Node 13 and claudiajs is working fine. Lamba only support up to Node 12, so unfortunately I cannot build/deploy with Node 15.

JustFly1984 commented 3 years ago

@jratiwanich it is not unfortunately, it is by design. Everybody is waiting for AWS lambda to support node 14 LTS without additional environment configuration. Node.js has LTS versions only for even versions, so there will be no node 13 LTS or 15 LTS versions. AWS has LTS policies and updates environments with delay. Though you can setup custom environment for AWS lambda if you have requirements to run latest version, and you need to make sure that your node_modules installed in the same node.js version as your current.