-
Notifications
You must be signed in to change notification settings - Fork 4k
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
appsync: appsync.HttpDataSourceProps
erroneously extends BaseDataSourceProps
#31979
Comments
@ScottRobinson03 , thanks for opening the issue and providing the code links. As its already pointed out, HttpDataSourceProps extends BaseDataSourceProps
and BaseDataSourceProps has these attrtibutes- export interface BaseDataSourceProps {
/**
* The API to attach this data source to
*/
readonly api: IGraphqlApi;
/**
* The name of the data source
*
* @default - id of data source
*/
readonly name?: string;
/**
* the description of the data source
*
* @default - None
*/
readonly description?: string;
} and HttpDataSource extends BackendDataSource- where the
export interface BackedDataSourceProps extends BaseDataSourceProps {
/**
* The IAM service role to be assumed by AppSync to interact with the data source
*
* @default - Create a new role
*/
readonly serviceRole?: IRole;
} which is the reason why the error is being seen. |
@ScottRobinson03 , I think you should be able to reopen the PR. Also please link this issue in the description and update whatever is needed to get the community review done. Let me know if you need any further help! Appreciate your contribution. |
@khushail Thanks, I've updated the PR description accordingly and left a comment too, however the comment didn't reopen the PR as I suspected. I assume this means I don't have permissions to reopen the PR, so are you perhaps able to do this on my behalf? |
@ScottRobinson03 , its reopened. Please feel free to work on it now. |
Thanks @khushail. Afaik there's no more work to do from me (the PR is just a one-line fix), so it's just pending reviews (and an integ-test exemption approval, since it's just a type fix [there's no runtime code to actually test]). |
…DataSourceProps` (#32065) ### Reason for this change Closes #31979. Replaces #29689. In #11185, the `HttpDataSource` class was updated to extend `BackedDataSource` instead of `BaseDataSource`, however the `HttpDataSourceProps` type wasn't updated to reflect this change. This PR makes the `HttpDataSourceProps` type reflect the change. ### Description of changes Makes the `HttpDataSourceProps` type extend `BackedDataSourceProps`, instead of `BaseDataSourceProps`. This means users are able to provide the `serviceRole` prop without getting a type error. ### Description of how you validated changes The below code snippet no longer gives an incorrect type error when providing the serviceRole, as it did before: ```ts import * as appsync from "aws-cdk-lib/aws-appsync"; import type { IRole } from "aws-cdk-lib/aws-iam"; declare const myApi: appsync.GraphqlApi; declare const serviceRole: IRole; const stepFunctionHttpDataSource = new appsync.HttpDataSource( myApi, "MyStepFunctionHTTPDataSource", { api: myApi, authorizationConfig: { signingRegion: "eu-west-1", signingServiceName: "states", }, endpoint: `https://states.eu-west-1.amazonaws.com`, name: "StepFunctionHTTPDataSource", // Providing the `serviceRole` now correctly DOESN'T throw a type error serviceRole, } ); ```
Comments on closed issues and PRs are hard for our team to see. |
Describe the bug
In #11185, the
HttpDataSource
class was updated to extendBackedDataSource
instead ofBaseDataSource
, however theHttpDataSourceProps
type wasn't updated to reflect this change.Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The
HttpDataSourceProps
type should extendBackendDataSourceProps
Current Behavior
The
HttpDataSourceProps
type erroneously extendsBaseDataSourceProps
Reproduction Steps
Minimum-repro to see the type error:
Possible Solution
Update the
HttpDataSourceProps
type to extendBackendDataSourceProps
Additional Information/Context
The only difference between
BaseDataSourceProps
andBackedDataSourceProps
, is thatBackedDataSourceProps
adds an optional propserviceRole
, which is required for workflows that require custom permissions, such as the above example of starting a state machine.The code for
BaseDataSourceProps
andBackedDataSourceProps
is here, and shown below:CDK CLI Version
2.139.0
Framework Version
No response
Node.js Version
20
OS
MacOS Sonoma 14.7
Language
TypeScript
Language Version
TypeScript 5.6.3
Other information
NB: #29689 would have fixed this however the PR was closed after going stale when requesting an exemption to requiring tests.
The text was updated successfully, but these errors were encountered: