Kelly Davis
10/13/2021, 10:00 PMNo native build was found for platform=darwin arch=x64 runtime=node abi=72 uv=1 libc=glibc node=12.22.6
at Function.load.path (.../node_modules/node-gyp-build/index.js:59:9) ...
There is a binary dependency, leveldown
which I've tried adding to bundle.nodeModules without success. I've confirmed that locally the darwin-x64 binary is present (in node_modules). I've also confirmed that the issue does not occur when deploying to the lambda to aws. Any suggestions?Frank
package.json
looks like and how you are defining the function?Kelly Davis
10/13/2021, 11:29 PMconst fun = new sst.Function(this, 'router', {
runtime: 'nodejs14.x',
handler: '../js/mylambda/src/index.koaHandler',
bundle: {
externalModules: ['aws-sdk'],
nodeModules: ['leveldown'],
},
timeout: 300,
environment: {
STAGE: stage,
BASE_HOSTNAME: process.env.BASE_HOSTNAME,
},
vpc,
vpcSubnets: {
subnets: [subnet1, subnet2]
},
})
{
...
"dependencies": {
"@aws-sdk/client-dynamodb": "^3.12.0",
"@koa/cors": "^3.1.0",
"axios": ">=0.21.2",
"glob-promise": "^4.2.1",
"koa": "^2.13.1",
"koa-bodyparser": "^4.3.0",
"koa-json": "^2.0.2",
"koa-router": "^10.0.0",
"level": "^7.0.0",
"serverless-http": "^2.7.0",
},
"devDependencies": {
"@babel/preset-typescript": "^7.12.7",
"@shopify/jest-koa-mocks": "^2.3.3",
"@types/aws-lambda": "^8.10.71",
"@types/body-parser": "^1.19.0",
"@types/cookie-parser": "^1.4.2",
"@types/cors": "^2.8.8",
"@types/express": "^4.17.8",
"@types/jest": "^26.0.20",
"@types/koa": "^2.13.1",
"@types/koa-json": "^2.0.18",
"@types/koa-router": "^7.4.1",
"@types/koa__cors": "^3.0.2",
"@types/level": "^6.0.0",
"@types/node": "^14.14.5",
"aws-sdk": "^2.635.0",
"aws-sdk-mock": "^5.1.0",
"jest": "26.6.0",
"jest-in-case": "^1.0.2",
"ts-jest": "^26.5.0",
"ts-node": "^9.1.1",
"tsup": "^3.7.1",
"typescript": "^4.1.3"
}
}