Thomas Ankcorn
01/26/2022, 10:50 PM.sst/artifacts/99a3edf9/src/lambda.handler is undefined or not exported
Thomas Ankcorn
01/26/2022, 10:51 PMThomas Ankcorn
01/26/2022, 10:51 PMimport SQS from 'aws-sdk/clients/sqs';
const sqs = new SQS();
// Your core application
const send = async (event) => {
console.log(event)
await sqs.sendMessage({
QueueUrl: '<https://sqs.eu-west-1.amazonaws.com/260235234243/dev-scheduler-Queue>',
MessageBody: JSON.stringify(event),
DelaySeconds: 15
}).promise()
return `Hello, World!`
};
export const handler = send;
Thomas Ankcorn
01/26/2022, 10:52 PMimport * as sst from "@serverless-stack/resources";
import { TableFieldType } from "@serverless-stack/resources";
export default class MyStack extends sst.Stack {
constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
super(scope, id, props);
const table = new sst.Table(this, "Table", {
fields: {
pk: TableFieldType.STRING,
sk: TableFieldType.STRING,
},
primaryIndex: { partitionKey: "pk", sortKey: "sk" },
});
const queue = new sst.Queue(this, "Queue", {
consumer: "src/queueConsumer.handler",
});
const cron = new sst.Cron(this, "Cron", {
schedule: "rate(5 minutes)",
job: {
environment: {
TABLE_NAME: table.tableName,
QUEUE_URL: queue.sqsQueue.queueUrl,
},
permissions: [queue],
function: "src/lambda.handler",
}
})
// Show the endpoint in the output
this.addOutputs({
"QueueURL": queue.sqsQueue.queueUrl,
});
}
}
Thomas Ankcorn
01/26/2022, 10:53 PMvar handler = send;
module.exports = __toCommonJS(lambda_exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
handler
});
//# sourceMappingURL=lambda.js.map
thdxr
01/26/2022, 11:04 PMthdxr
01/26/2022, 11:05 PMThomas Ankcorn
01/26/2022, 11:05 PMThomas Ankcorn
01/26/2022, 11:06 PMThomas Ankcorn
01/26/2022, 11:08 PMthdxr
01/26/2022, 11:11 PMexport const handler = ...
instead of aliasing it to send firstThomas Ankcorn
01/26/2022, 11:15 PMThomas Ankcorn
01/26/2022, 11:15 PMvar handler = async (scheduleDetails) => {
console.log(scheduleDetails);
await sqs.sendMessage({
QueueUrl: "<https://sqs.eu-west-1.amazonaws.com/260235234243/dev-scheduler-Queue>",
MessageBody: JSON.stringify(scheduleDetails),
DelaySeconds: 15
}).promise();
return `Hello, World!`;
};
module.exports = __toCommonJS(lambda_exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
handler
});
//# sourceMappingURL=lambda.js.map
Thomas Ankcorn
01/26/2022, 11:15 PMthdxr
01/26/2022, 11:18 PMthdxr
01/26/2022, 11:18 PMconst send = async (event) => {
console.log("Hello World!")
}
export const handler = send
And I can't replicateThomas Ankcorn
01/26/2022, 11:20 PMThomas Ankcorn
01/26/2022, 11:23 PMthdxr
01/26/2022, 11:23 PMThomas Ankcorn
01/26/2022, 11:24 PM{
"extends": "@tsconfig/node14",
"include": [
"stacks",
"src"
]
}
Thomas Ankcorn
01/26/2022, 11:25 PMThomas Ankcorn
01/26/2022, 11:25 PMthdxr
01/26/2022, 11:25 PMThomas Ankcorn
01/26/2022, 11:26 PMPreparing your SST app
The package "esbuild-darwin-arm64" could not be found, and is needed by esbuild.
If you are installing esbuild with npm, make sure that you don't specify the
"--no-optional" flag. The "optionalDependencies" package.json feature is used
by esbuild to install the correct binary executable for your current platform.
npm notice
npm notice New minor version of npm available! 8.1.2 -> 8.3.2
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.3.2>
npm notice Run npm install -g npm@8.3.2 to update!
npm notice
➜ my-sst-app npm start
thdxr
01/26/2022, 11:26 PMtarget: "node14",
thdxr
01/26/2022, 11:26 PMThomas Ankcorn
01/26/2022, 11:26 PMThomas Ankcorn
01/26/2022, 11:27 PMthdxr
01/26/2022, 11:28 PMthdxr
01/26/2022, 11:28 PMthdxr
01/26/2022, 11:29 PMconst send = async (event) => {
console.log("Hello World!")
}
export const handler = send
thdxr
01/26/2022, 11:29 PMThomas Ankcorn
01/26/2022, 11:29 PMthdxr
01/26/2022, 11:30 PMThomas Ankcorn
01/26/2022, 11:30 PMthdxr
01/26/2022, 11:30 PMThomas Ankcorn
01/26/2022, 11:30 PMvar handler = async (event) => {
return {
statusCode: 200,
headers: { "Content-Type": "text/plain" },
body: `Hello, World! Your request was received at ${event.requestContext.time}.`
};
};
module.exports = __toCommonJS(lambda_exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
handler
});
//# sourceMappingURL=lambda.js.map
Thomas Ankcorn
01/26/2022, 11:30 PMThomas Ankcorn
01/26/2022, 11:30 PMthdxr
01/26/2022, 11:30 PM__toCommontJs
Thomas Ankcorn
01/26/2022, 11:31 PMThomas Ankcorn
01/26/2022, 11:31 PMthdxr
01/26/2022, 11:31 PMthdxr
01/26/2022, 11:31 PMThomas Ankcorn
01/26/2022, 11:33 PMThomas Ankcorn
01/26/2022, 11:33 PM