sparse-intern-71089
01/30/2019, 8:58 PMtall-librarian-49374
01/30/2019, 9:02 PMclean-car-30047
01/30/2019, 9:07 PMtall-librarian-49374
01/30/2019, 9:08 PMimport * as aws from "@pulumi/aws";
bucket.onObjectCreated("postToSlack", async (e) => {
  // direct access to the aws-sdk through `aws.sdk`.
  const sqs = new aws.sdk.SQS();
  sqs.sendMessage(/*...*/);
});tall-librarian-49374
01/30/2019, 9:08 PMclean-car-30047
01/30/2019, 9:09 PMtall-librarian-49374
01/30/2019, 9:10 PMtall-librarian-49374
01/30/2019, 9:12 PMtall-librarian-49374
01/30/2019, 9:14 PMclean-car-30047
01/30/2019, 9:36 PMModule './node_modules\\@pulumi\\aws\\index.js' is a 'deployment only' module. In general these cannot be captured inside a 'run time' function.
    error: an unhandled error occurred: Program exited with non-zero exit code: 1tall-librarian-49374
01/30/2019, 9:43 PMtall-librarian-49374
01/30/2019, 9:44 PMtall-librarian-49374
01/30/2019, 9:44 PMclever-sunset-76585
01/30/2019, 9:57 PMsendMessageBatch from the SQS client.
// The `aws-sdk` is a transient dependency of pulumi-aws.
import { SQS } from 'aws-sdk`;
try {
  const outputSQS = new SQS();
  await outputSQS.sendMessageBatch({
    Entries: [{Id: "someUniqueIDForThisMessage", MessageBody: myMessageBody}],
    QueueUrl: outputSQSURL
  }).promise();
} catch (err) {
  console.log("Error sending a batch", err);
}
Although, I do think that creating an SQS client from the aws.sdk object should have serialized the right imports in your Lambda. @lemon-spoon-91807 would be able to comment on that.clean-car-30047
01/30/2019, 10:10 PMimport * as aws from '@pulumi/aws';
import * as serverless from '@pulumi/aws-serverless';
const stage1Queue = new aws.sqs.Queue('stage-1', { visibilityTimeoutSeconds: 360 });
const stage2Queue = new aws.sqs.Queue('stage-2', { visibilityTimeoutSeconds: 360 });
serverless.queue.subscribe('stage-1', stage1Queue, async (e: any) => {
    console.log('Starting stage 1...');
    // Do some things
    // ...
    // Send to next stage
    const sqs = new aws.sdk.SQS();
    sqs.sendMessage({
        QueueUrl: stage2Queue.id.get(),
        MessageBody: '...'
    });
}, { batchSize: 1 });
exports = {
    stage1QueueURL: stage2Queue.id,
    stage2QueueURL: stage2Queue.id
};clean-car-30047
01/30/2019, 10:11 PMlemon-spoon-91807
01/30/2019, 10:12 PMHow can I write to an SQS queue from within a lambda?
clever-sunset-76585
01/30/2019, 10:12 PMSQS client directly from the aws-sdk as in my code snippet?lemon-spoon-91807
01/30/2019, 10:12 PMlemon-spoon-91807
01/30/2019, 10:13 PMaws.sdk if aws is your imported @pulumi/awslemon-spoon-91807
01/30/2019, 10:13 PMlemon-spoon-91807
01/30/2019, 10:14 PMlemon-spoon-91807
01/30/2019, 10:14 PMbucket.onObjectCreated("postToSlack", async (e) => {
  // direct access to the aws-sdk through `aws.sdk`.
  const sqs = new aws.sdk.SQS();
  sqs.sendMessage(/*...*/);
});lemon-spoon-91807
01/30/2019, 10:14 PMlemon-spoon-91807
01/30/2019, 10:14 PMclean-car-30047
01/30/2019, 10:14 PMlemon-spoon-91807
01/30/2019, 10:15 PMclean-car-30047
01/30/2019, 10:15 PMlemon-spoon-91807
01/30/2019, 10:16 PMawait import('aws-sdk')tall-librarian-49374
01/30/2019, 10:23 PMaws-serverless sorta legacy?lemon-spoon-91807
02/03/2019, 1:48 AM