Jon Baker
04/26/2022, 1:05 PMyarn start
then I don’t have any issues but if I do a yarn deploy
I get an Expected signal to be an instanceof AbortSignal
error. It seems related to node-fetch
requests (The lambda uses the Airtable NPM to request some data from Airtable). I’m guessing there are some permissions needed perhaps I’ve got no VPC’s and it’s not really clear? Anyone seen this or able to help? My Stack is configured as follows:
const api = new sst.Api(this, 'Api', {
authorizers: {
feAuthorizer: {
type: 'jwt',
jwt: {
issuer: process.env.ISSUER,
audience: [process.env.AUDIENCE],
},
},
},
defaults: {
authorizer: 'feAuthorizer',
},
routes: {
'GET /': 'src/lambda.handler',
'POST /new-member': {
function: {
handler: 'src/newMember/newMemberHandler.handler',
environment: {
FE_CLIENT_ID: process.env.FE_CLIENT_ID,
FE_SECRET: process.env.FE_SECRET,
FE_TENANT_ID: process.env.FE_TENANT_ID,
AIRTABLE_API_KEY: process.env.AIRTABLE_API_KEY,
AIRTABLE_BASE_ID: process.env.AIRTABLE_BASE_ID,
MONGO_URI: process.env.MONGO_URI,
},
},
},
},
});
Jon Baker
04/26/2022, 1:07 PMserverless-esbuild
to build the deployJon Baker
04/26/2022, 2:13 PMserverless-esbuild
works but Serverless-stack’s build doesn’t?Jon Baker
04/26/2022, 2:27 PMairtable
npm in the functions bundle: {.nodeModules }
Jon Baker
04/26/2022, 2:28 PMFrank
{
handler: "src/newMember/newMemberHandler.handler",
environment: {
...
},
bundle: {
nodeModules: ["airtable"],
},
}
Frank
minify
enabled by default. And the node-fetch
doesn’t play well with minify
according to this issue https://github.com/node-fetch/node-fetch/issues/784Frank
keepNames
, that might work according to this comment https://github.com/node-fetch/node-fetch/issues/784#issuecomment-1014768204Frank
{
handler: "src/newMember/newMemberHandler.handler",
environment: {
...
},
bundle: {
esbuild: {
keepNames: true
}
}
}
Frank
Jon Baker
04/27/2022, 8:45 AMtype '{ esbuild: { keepNames: true; }; }' is not assignable to type 'FunctionBundleProp'.
Object literal may only specify known properties, and 'esbuild' does not exist in type 'FunctionBundleNodejsProps | FunctionBundlePythonProps'.ts(2322)
Jon Baker
04/28/2022, 8:33 AM