question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`appsync.GraphqlApi.addLambdaDataSource` doesn't strip symbols from `id` name, causing deploy to fail

See original GitHub issue

Doing something like the following:

const api = /* create api */
api.addLambdaDataSource(
      "lambda-name-ds",
      /* lambda */,
    );

does not remove the - from the id name, causing the deploy to fail with:

Property validation failure: [Value for property {/Name} does not match pattern {[_A-Za-z][_0-9A-Za-z]*}]

And if we look at the resulting stack.template.json file, we see the error is present:

{
    "lambdadatasourceid": {
        /* ... */
        "Name": "ambda-name-ds"
        /* ... */
    }
}

Reproduction Steps

Just create any appsync GraphQL API and add a lambda datasource that contains -. (haven’t tested if other symbols also trip it up)

What did you expect to happen?

I expect the - to be stripped out, just like all other id’s in the CDK along with the deploy not failing.

What actually happened?

The deploy fails.

Environment

  • CDK CLI Version : 1.119.0 (build 2921d64)
  • Framework Version: 1.119.0
  • Node.js Version: v16.6.1
  • OS : Ubuntu (WSL 2)
  • Language (Version): TypeScript ~3.9.7

This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
readybuilderonecommented, Sep 6, 2021

I tried to created an S3 bucket using CDK with ID including various unusual characters as following: image

I compared the logical id in the aws console of cloudformation, and found all the unusual characters were stripped. image

By this logical analogy, I think we should stripe all of the characters except [_0-9A-Za-z] instead of just stripe ‘-’ only. What do you think? @otaviomacedo @BryanPan342 @jquesada2016 , if you don’t mind, I’d like try to solve this issue.

0reactions
github-actions[bot]commented, Feb 4, 2022

⚠️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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authorization and authentication - AWS AppSync
There are five ways you can authorize applications to interact with your AWS AppSync GraphQL API. You specify which authorization type you use...
Read more >
Deploy an AWS AppSync GraphQL API with CloudFormation
This is a good model for creating IAM roles that you will need. Each resource you create has a logical name that is...
Read more >
Serverless Appsync Plugin
Deploy AppSync API's in minutes using this Serverless plugin. Getting Started. Be sure to check out all that AWS AppSync has to offer....
Read more >
API (GraphQL) - Client code generation - AWS Amplify Docs
Codegen add workflow triggers automatically when an AppSync API is pushed to ... 1 id content post { # depth level 2 id...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found