-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
aws-apigatewayv2.CfnApiMapping
: Says there is already a Construct with name when there is not
#29844
Comments
aws-apigatewayv2.CfnApiMapping
: Says there is already a Construct with name when there is not
The error occurres here:
const basePath = `some/path`;
domainName.addApiMapping(myAPI.deploymentStage, {
basePath,
}); This is because I think you will need to create the This is my PoC: export class MyDemoStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
// Imports
const myAPIID = Fn.importValue(`some-other-exported-api-id`);
const myAPI = agw.RestApi.fromRestApiId(this, "myAPI", myAPIID);
// Init of domain name
const domainNameAsString = 'foo.com';
const CertificateARN = `.......`;
const certificate = acm.Certificate.fromCertificateArn(this, "certificate", CertificateARN);
const subdomain = `.....`;
const domainName = new agw.DomainName(this, `DomainName_${subdomain}`, {
domainName: domainNameAsString,
certificate,
basePath: "/",
endpointType: agw.EndpointType.REGIONAL,
});
// Base paths work fine
domainName.addBasePathMapping(myAPI, {
basePath: `routeThatWorks`,
stage: myAPI.deploymentStage,
});
new apigwv2.CfnApiMapping(this, `ApiMapping_jumanji2`, {
apiId: myAPI.restApiId,
domainName: domainNameAsString,
stage: `development`,
apiMappingKey: `some/path`,
});
}
} And I can |
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
@pahud I tried this method as specified in my original submission The error I got was Even though this is the only time I am creating it |
I guess you probably have some extra code generating the same construct id. Can you just run my provided PoC above and see if you still have this error? |
Your PoC worked. I was able to find the issue in my code. One of my deployment environments did in fact double-add it due to a configuration setting causing a loop. |
|
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one. |
Describe the bug
I am setting up domainName basePath and api mappings. The APIGateway Rest APIs are outputs of other stacks and they are imported into the current cdk app.
basePath mappings works flawlessly. However, when I try to use the
apiMapping
, it complains withThere is already a Construct with name '${childName'} in ${typeName}
I am only adding it in one place. And the name I give it is definitlely unique.
I tried several methods that give the same error.
Expected Behavior
The ApiMapping and/or Stage constructs get initialized with no errors()
Current Behavior
Fatal error:
There is already a Construct with name '${childName'} in ${typeName}
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.137.0 (build bb90b4c)
Framework Version
No response
Node.js Version
v18.5.0
OS
OSX Sonoma 14.4.1
Language
TypeScript
Language Version
Typescript (5.4.5)
Other information
No response
The text was updated successfully, but these errors were encountered: