I'm creating a cloudfront distribution with attach...
# automation-api
h
I'm creating a cloudfront distribution with attached lambda functions ("Lambda@Edge"). The ARN and Version properties on my lambda functions (
aws.lambda.CallbackFunction
) are resolving to
undefined
inside
apply
. Why would that be? (thread)
Relevant code, creating a lambda & associating it with CloudFront:
Copy code
directoryRetryHandler = new aws.lambda.CallbackFunction(`...`, {
  ...
}),

docsDistribution = new aws.cloudfront.Distribution(`...`, {
  defaultCacheBehavior: {
    ...
    lambdaFunctionAssociations: [{
      eventType: "origin-response",
      lambdaArn: pulumi.interpolate`${directoryRetryHandler.arn}:${directoryRetryHandler.version}`,
    }]
  }
}),
When I try to bring the stack up, AWS complains:
Copy code
error creating CloudFront Distribution: InvalidLambdaFunctionAssociation: Invalid function ARN: undefined:undefined
This same code previously worked with the CLI ...
l
I believe you are hitting this known issue: https://github.com/pulumi/pulumi/issues/5578 The workaround is setting the `workdir`: https://github.com/pulumi/halloumi/blob/main/nodejs/app/index.ts#L106
h
Ah I'll try that
That did the trick, thanks!