This message was deleted.
s
This message was deleted.
f
Could you please provide some of the code you’re using that causes this?
a
Copy code
import * as aws from '@pulumi/aws';
import { QueueEventSubscription, QueueEvent } from '@pulumi/aws/sqs';
import { lambdaRole } from '../../iam_roles/lambda_role';
const region = aws.config.requireRegion();

const queue = new aws.sqs.Queue('emailNotifications', {
  visibilityTimeoutSeconds: 240
});
const callback = new aws.lambda.CallbackFunction<QueueEvent, QueueEventSubscription>('emailNotification', {
  role: lambdaRole,
  codePathOptions: {
    extraExcludePackages: ['typescript']
  },
  callback: (e, _context, callback) => {
    const aws = require('aws-sdk');
    const ses = new aws.SES({ region });

    for (let record of e.Records) {
      const { subject, body, from, to } = JSON.parse(record.body);
      console.log('Record:', record.body);
      const params = {
        Destination: {
          ToAddresses: to
        },
        Message: {
          Body: {
            Text: { Data: body }
          },

          Subject: { Data: subject }
        },
        Source: from
      };

      ses.sendEmail(params, function(err, data) {
        callback(err, data);
      });
    }
  }
});
queue.onEvent('onEmailNotification', callback);

export const emailNotificationQueue = queue;
This is just one component, but it gets the same error when creating the lambda
f
Thanks — I’ll try to take a look later today
I couldn’t repro this
Running the code, I get just one function creation — is it possible you have this source referenced multiple times?
204 Views