astonishing-gpu-37274
05/24/2020, 7:36 AMerror: Error creating Lambda function: ResourceConflictException: Function already exist: ****-8d56ff7
{
RespMetadata: {
StatusCode: 409,
RequestID: "a4e2508b-7d19-43cc-93db-e08b1f64914e"
},
Message_: "Function already exist: ***-8d56ff7",
Type: "User"
}
I tried using --refresh, recreating the stack, switching to a different account.
The lambda is actually created even when this error occur
Looking at the AWS cloudtrail events, I see that CreateFunction is called twice, with a 2 min difference(the time it takes to create it).
Using the latest pulumi version, anyone knows how to resolve? As a workaround I'm quickly deleting the lambda before the 2nd time it creates it, and that seems to make the pulumi update finish successfullyfaint-table-42725
05/26/2020, 4:47 AMastonishing-gpu-37274
05/26/2020, 5:53 AMimport * 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;
faint-table-42725
05/26/2020, 4:53 PM