Skip to content
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

(apigateway): RestApi.fromRestApiAttributes() does not add salt to resource #12425

Closed
taoatmars opened this issue Jan 8, 2021 · 3 comments
Closed
Assignees
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@taoatmars
Copy link

If the RestApi is define by RestApi.fromRestApiAttributes(), any deployment will not add salt to the deployment resource.

Reproduction Steps

This is my code.

const api = RestApi.fromRestApiAttributes(this, 'ImportedApi', {
      restApiId: XXX,
      rootResourceId: XXX,
    });

    const allResources = api.root.addResource('cdk');

    allResources.addCorsPreflight({ allowOrigins: Cors.ALL_ORIGINS });

    const method = allResources.addMethod('PUT', ifn, {
      methodResponses: [
        {
          statusCode: '200',
          responseParameters: {
            'method.response.header.Access-Control-Allow-Origin': true,
          },
        },
      ],
      authorizationType: AuthorizationType.IAM,
    });

    // Handle deployment
    const deployment = new Deployment(this, '123_deployment', {
      api: RestApi.fromRestApiId(this, 'abc', apiCDKApiApiId),
    });
    new Stage(this, 'CDKApiStageDev', { deployment, stageName: `${ENV}` });

"o4aytaotest123deploymentC642C343" is the resource name in the Cloudformation template.

What did you expect to happen?

add salt to the resource name

What actually happened?

no salt was added to the resource name

Environment

  • **CDK CLI Version :1.83
  • Framework Version:
  • Node.js Version:
  • **OS :MAC
  • **Language (Version):TypeScript

Other

!!!!!!!!!!!!!!!!
WORKAROUND: Just in case anyone ran into the same problem, you can manually add salt to the logical ID by calling deployment.addToLogicalId()


This is 🐛 Bug Report

@taoatmars taoatmars added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 8, 2021
@NGL321 NGL321 changed the title (module name): short issue description (apigateway): RestApi.fromRestApiAttributes() does not add salt to resource Feb 1, 2021
@github-actions github-actions bot added the @aws-cdk/aws-apigateway Related to Amazon API Gateway label Feb 1, 2021
@NGL321
Copy link
Contributor

NGL321 commented Feb 1, 2021

Hey @taoatmars,

Thank you for reporting this, someone from the team will take a look as soon as able. In the future however, please ensure that your issue title follows the template guidelines so it gets properly sorted and we get to it in a more timely fashion!

Thanks much! 😄

😸 😷

@nija-at
Copy link
Contributor

nija-at commented Feb 2, 2021

We're already tracking this issue - #12417

Thanks.

@nija-at nija-at closed this as completed Feb 2, 2021
@github-actions
Copy link

github-actions bot commented Feb 2, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants