Closed simon-fisher closed 4 years ago
Hi @simon-fisher - can you provide the error for the failure you are experiencing?
Here is the initial error I had:
[PS C:\Projects\aws2\koop-provider-sample2\koop-provider-sample> npm run lambda-create
_> koop-provider-sample@1.0.0 lambda-create C:\Projects\aws2\koop-provider-sample2\koop-provider-sample
claudia create --name koop-provider-geojson --handler lambda.handler --deploy-proxy-api --region us-east-1 --set-env KOOP_PORT=80,DEPLOY=export
packaging files npm install -q --no-audit --production
farmhash@2.1.0 install C:\Users\SF\AppData\Local\Temp\C1hc17\koop-provider-sample-1.0.0-tW2cYH\package\node_modules\farmhash prebuild-install || node-gyp rebuild
validating package
Error: Cannot find module 'C:\Users\SF\AppData\Local\Temp\C1hc17\koop-provider-sample-1.0.0-tW2cYH\package\lambda'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at validatePackage (C:\Users\SF\AppData\Roaming\npm\node_modules\claudia\src\tasks\validate-package.js:16:15)
at initEnvVarsFromOptions.then.then.then.then.then.then.then.dir (C:\Users\SF\AppData\Roaming\npm\node_modules\claudia\src\commands\create.js:344:10)
at process._tickCallback (internal/process/next_tick.js:68:7)
cannot require ./lambda after clean installation. Check your dependencies.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! koop-provider-sample@1.0.0 lambda-create: claudia create --name koop-provider-geojson --handler lambda.handler --deploy-proxy-api --region us-east-1 --set-env KOOP_PORT=80,DEPLOY=export
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the koop-provider-sample@1.0.0 lambda-create script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\SF\AppData\Roaming\npm-cache_logs\2019-07-26T14_22_00382Z-debug.log](url)
I was able to work through this error by adding in the lambda.js file and the necessary aws-serverless-express from the "koop-provider-arcgis-search" example. (which also does not deploy to aws lambda by the way).
Once I got through that issue it gets further, but here is the current error I am stuck on:
_zipping package fs.js:114 throw err; ^
Error: EPERM: operation not permitted, unlink 'C:\Users\SF\AppData\Local\Temp\f8uo3l\koop-provider-sample-1.0.0-NBMZGP\package\node_modules\farmhash\build\Release\farmhash.node'
at Object.unlinkSync (fs.js:951:3)
at fixWinEPERMSync (C:\Users\SF\AppData\Roaming\npm\node_modules\claudia\node_modules\fs-extra\lib\remove\rimraf.js:169:13)
at rimrafSync (C:\Users\SF\AppData\Roaming\npm\node_modules\claudia\node_modules\fs-extra\lib\remove\rimraf.js:260:26)
at options.readdirSync.forEach.f (C:\Users\SF\AppData\Roaming\npm\node_modules\claudia\node_modules\fs-extra\lib\remove\rimraf.js:291:39)
at Array.forEach (claudia create --name koop-provider-geojson --handler lambda.handler --deploy-proxy-api --region us-east-1 --set-env KOOP_PORT=80,DEPLOY=export
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the koop-provider-sample@1.0.0 lambda-create script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\SF\AppData\Roaming\npm-cache_logs\2019-07-26T14_40_09171Z-debug.log
Any ideas on this?
Anyone have experience or luck deploying koop to AWS? I can't seem to get it to work.
@simon-fisher - sorry for the delay. My initial guess is that this is because lambda doesn't support node-gyp building, which is required by the farmhash dependency.
Thanks Rich, any suggestions on a workaround?
I think you won't be able to use something as straightforward as claudia to deploy. From what I have read, you need to npm install
the application in a Linux environment (preferably Amazon Linux), then zip up the installation and ship to lambda. This post gives some more details: https://stackoverflow.com/questions/30340443/cross-compile-node-module-with-native-bindings-with-node-gyp
@simon-fisher I'm going to see if swapping out farmhash for a different hashing module solves this. Stay tuned.
You can also consider using serverless framework. See this example https://github.com/koopjs/koop-serverless-example
Has anyone tried using the sample to deploy to AWS Lambda lately? It fails on the "npm run lambda-create". At least for me. Anyone have success?