-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(cloudfront): identifier not found #15765
Comments
Hey @jordanmonier 👋 This is odd. It looks like the CDK generated identifier is missing an |
Hi @ryparker 👋 I will do that as soon as possible but to quickly resume the hierarchy, my cf function is located inside :
Thank you for your feedback ! |
Hello 👋 I am also affected by this issue. Here's a minimal example of code that can be used to replicate the bug. This was tested with 1.118.0 and 1.117.0.
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from '@aws-cdk/core';
import { CfFuncFailStack } from '../lib/cf-func-fail-stack';
const app = new cdk.App();
new CfFuncFailStack(app, 'CfFuncFailStack', {});
import * as cdk from '@aws-cdk/core';
import { CfFuncConstruct } from './constructs/cf-func';
export class CfFuncFailStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
new CfFuncConstruct(this, 'CfFuncConstruct')
}
}
import * as cdk from '@aws-cdk/core'
import * as cloudfront from '@aws-cdk/aws-cloudfront'
export class CfFuncConstruct extends cdk.Construct {
constructor (scope: cdk.Stack, id: string) {
super(scope, id)
new cloudfront.Function(this, 'RedirectionCloudFrontFunction', {
code: cloudfront.FunctionCode.fromFile({
filePath: 'lib/cloudfront-functions/my_func.js'
})
})
}
}
function handler(event) {
console.log('test2')
} The bug is erratic. To replicate it, deploy the stack, modify the javascript function (changing the test2 string is sufficient), and redeploy. If the bug doesn't occur, change the string again and deploy again (I use It takes 2-3 tries, but you eventually get the following error:
There seems to be a mismatch between the resource name that CDK tries to update ( For now, the workaround is just to try again when it fails, and it will usually work within 1-2 retries. If you need any more information, let me know! |
I believe this is likely a duplicate of #15523. Can you try the workaround listed there, and see if that resolves it? If so, we can close this as a duplicate and track the fix there. |
Yep, this looks like the same issue. The workaround mentioned does seem to fix the problem. Thank you! I should have looked a bit harder 😅 |
Thanks for the confirmation. I'm going to assume the same for @jordanmonier . Closing -- feel free to ping me if the linked issue is distinct from the original issue here. Otherwise, please track the status on #15523 . |
|
We are using some Cloudfront Functions for our distributions but when we are deploying some changes our pipeline fails because it can not find the cloudfront based on its identifier. The problem is that the identifier that CDK Pipeline has is not correct.
Here's the error :
Resource handler returned message: "Resource of type 'AWS::CloudFront::Function' with identifier 'eu-west-1mdscicdmdOfficeStaticSiteFunctionC23238D5' was not found." (RequestToken: 04588f89-6822-7f5d-22b2-c5c61f92ba7a, HandlerErrorCode: NotFound)
As you can see AWS CDK tries to find this identifier :
eu-west-1mdscicdmdOfficeStaticSiteFunctionC23238D5
While the identifier found on the console is :
eu-west-1mdscicdmdsOfficeStaticSiteFunctionC23238D5
Environment
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: