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

(aws-appsync): RdsDataSource misses option to set dataBaseName #12572

Assignees
Labels
@aws-cdk/aws-appsync Related to AWS AppSync bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@monholm
Copy link
Contributor

monholm commented Jan 18, 2021

Creating seperate issues for #12503 to improve structure.

It seems like there's no way to add the databasename to a RdsDataSource, which results in a "No database selected" error when running a resolver.

Reproduction Steps

const api = new GraphqlApi(stack, 'api', {
  name: 'graphqlApi',
  schema: Schema.fromAsset('./testSchema.graphql'),
});

const serverless = new ServerlessCluster(stack, 'cluster', {
  engine: DatabaseClusterEngine.AURORA_MYSQL,
  vpc: new Vpc(stack, 'vpc'),
});

api.addRdsDataSource('rdsDS', serverless, serverless.secret!);

What did you expect to happen?

addRdsDataSource to include a prop for databaseName.

What actually happened?

There's no prop for databaseName.

Environment

  • CDK CLI Version: 1.84.0
  • Framework Version: 1.84.0
  • Node.js Version: 14.5.4
  • OS: MacOS 10.15.7
  • Language (Version): TypeScript (3.9.7)

This is 🐛 Bug Report

@BerndWessels
Copy link

this is still not resolved in "@aws-cdk/aws-appsync": "^1.89.0", and renders RdsDataSource useless.

@BerndWessels
Copy link

@Simon-TechForm my workaround here is as follows. But I really hope AWS is not neglecting the CDK and will take your PRs soon.

        /**
         * Database Data Source
         * TODO: Missing databaseName and databaseSchema https://github.com/aws/aws-cdk/issues/12572
         */
        const databaseDataSource = api.addRdsDataSource(
            "DatabaseDataSource",
            (databaseCluster as unknown) as rds.IDatabaseCluster,
            databaseCluster.secret as secretsManager.ISecret,
            {
                description: "My Product Serverless Aurora RDS Database Data Source",
                name: "MyProductDatabaseDataSource",
            }
        );

        /**
         * TODO: Missing databaseName and databaseSchema https://github.com/aws/aws-cdk/issues/12572
         */
        const cfnDataSource = databaseDataSource.node.defaultChild as appsync.CfnDataSource;
        cfnDataSource.addPropertyOverride("RelationalDatabaseConfig.RdsHttpEndpointConfig.DatabaseName", "my_product");
        cfnDataSource.addPropertyOverride("RelationalDatabaseConfig.RdsHttpEndpointConfig.Schema", "public");

@mergify mergify bot closed this as completed in #12575 Feb 19, 2021
mergify bot pushed a commit that referenced this issue Feb 19, 2021
Fixes: #12572

BREAKING CHANGE: graphqlapi.addRdsDataSource now takes databaseName as its fourth argument


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

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

eladb pushed a commit that referenced this issue Feb 22, 2021
Fixes: #12572

BREAKING CHANGE: graphqlapi.addRdsDataSource now takes databaseName as its fourth argument


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This was referenced Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment