Skip to content

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

@jquesada2016

Description

@jquesada2016

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-appsyncRelated to AWS AppSyncbugThis issue is a bug.good first issueRelated to contributions. See CONTRIBUTING.mdp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions