-
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
Error: Resource's path part only allow [a-zA-Z0-9:._-], an optional trailing '+'(module name) #27083
Comments
If I understand this right, this is a CloudFormation limitation, not a CDK limitation at its heart. The CLI and Console do not interact with CloudFormation, thus are not subject to its limitations. |
@indrora are there any docs from CloudFormation stating this limitation? Have we tried working around this with escape hatches to confirm? |
|
There isn't any issue with setting the const restApi = new apigw.RestApi(this, 'restApi', {
deploy: true,
});
const apiResource = restApi.root?.addResource("testwithoutdollar");
(apiResource.node.defaultChild as apigw.CfnResource).addPropertyOverride('PathPart', '$testwithoutdollar');
restApi.root.addMethod('GET'); Deploying this results in the following: I think it should work fine if we change the code found at
Edit: Actually, on a further look, special characters like |
I may be able to implement this fix. |
… resources beginning with dollar sign (#27619) This PR adjusts the validation rules for path parts in resources created using the APIGateway library to allow the use of dollar mark in pathParts, as requested in #27083. This enables the creation of resources with paths such as $test(from the reproduction steps in the related issue). An existing resource unit test ('url for a resource') has been updated to ensure that a dollar mark in a pathPart does not throw an error and properly reflects in the output of RestApi.urlForPath. The integration test integ.restapi has also been updated, wherein the appliances resource now has a path of $appliances:all instead of appliances:all. Closes #27083. #### All Submissions: - [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) #### Adding new Unconventional Dependencies: - [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) #### New Features - [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? - [x] Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)? By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
|
… resources beginning with dollar sign (#27619) This PR adjusts the validation rules for path parts in resources created using the APIGateway library to allow the use of dollar mark in pathParts, as requested in #27083. This enables the creation of resources with paths such as $test(from the reproduction steps in the related issue). An existing resource unit test ('url for a resource') has been updated to ensure that a dollar mark in a pathPart does not throw an error and properly reflects in the output of RestApi.urlForPath. The integration test integ.restapi has also been updated, wherein the appliances resource now has a path of $appliances:all instead of appliances:all. Closes #27083. #### All Submissions: - [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) #### Adding new Unconventional Dependencies: - [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) #### New Features - [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? - [x] Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)? By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
Describe the bug
CDK v2 api gateway won't allow "$" sign in the url, but it "$" is allows using AWS CLI and Console
Error: Resource's path part only allow [a-zA-Z0-9:._-], an optional trailing '+'
and curly braces at the beginning and the end: $test
at validateResourcePathPart
Expected Behavior
No error when using $ in the api path just like AWS CLI or Console
Current Behavior
Error: Resource's path part only allow [a-zA-Z0-9:._-], an optional trailing '+'
and curly braces at the beginning and the end: $process-message
at validateResourcePathPart
Reproduction Steps
const restApi = new RestApi(this, 'restApi', {
deploy: true,
})
restApi.root?.addResource("$test")
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.95.1 (build ae455d8)
Framework Version
No response
Node.js Version
v18.16.1
OS
Ubuntu 22.04.2 LTS
Language
Typescript
Language Version
5.2.2
Other information
No response
The text was updated successfully, but these errors were encountered: