-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
(elasticsearch): Domain.fromDomainAttributes gives "Invalid URL" when endpoint is a token #15188
Comments
We should extract the domain name from the ARN instead of the endpoint, if it's available. Change required here:
Stack.parseArn .
@HelioStrike if you create a PR for this fix, please feel free to request my review |
…hen endpoint is a token (#15219) `Domain.fromDomainAttributes` throws the error "Invalid URL" when a token endpoint is provided. In this PR, the domain name is retrieved from the scope using the arn present in `DomainAttributes`, and if no name is found, we try to get it from the endpoint (as it has been done so far). Also added a test to verify that the error disappears with this change, even when it is given token attributes. closes #15188 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
…hen endpoint is a token (aws#15219) `Domain.fromDomainAttributes` throws the error "Invalid URL" when a token endpoint is provided. In this PR, the domain name is retrieved from the scope using the arn present in `DomainAttributes`, and if no name is found, we try to get it from the endpoint (as it has been done so far). Also added a test to verify that the error disappears with this change, even when it is given token attributes. closes aws#15188 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…hen endpoint is a token (aws#15219) `Domain.fromDomainAttributes` throws the error "Invalid URL" when a token endpoint is provided. In this PR, the domain name is retrieved from the scope using the arn present in `DomainAttributes`, and if no name is found, we try to get it from the endpoint (as it has been done so far). Also added a test to verify that the error disappears with this change, even when it is given token attributes. closes aws#15188 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…hen endpoint is a token (aws#15219) `Domain.fromDomainAttributes` throws the error "Invalid URL" when a token endpoint is provided. In this PR, the domain name is retrieved from the scope using the arn present in `DomainAttributes`, and if no name is found, we try to get it from the endpoint (as it has been done so far). Also added a test to verify that the error disappears with this change, even when it is given token attributes. closes aws#15188 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Documentation for changes made in PR #15219 - issue #15188 Normally one would not put the domain endpoint as a static value in a CF stack. A more realistic use case is to manage an opensearch domain from CF stack A and use it via CF stack B, C, D ... Stack A would export the domainEndpoint and also domainArn - the other stacks can then import those values and import the domain. This PR will add an example for the realistic scenario so people do not end up with errors like "Invalid URL" when a token endpoint is provided. ---- ### 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 * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] 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*
Documentation for changes made in PR aws#15219 - issue aws#15188 Normally one would not put the domain endpoint as a static value in a CF stack. A more realistic use case is to manage an opensearch domain from CF stack A and use it via CF stack B, C, D ... Stack A would export the domainEndpoint and also domainArn - the other stacks can then import those values and import the domain. This PR will add an example for the realistic scenario so people do not end up with errors like "Invalid URL" when a token endpoint is provided. ---- ### 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 * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] 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*
I'm getting a
Invalid URL
when trying to useDomain.fromDomainAttributes
with a CfnDomain object. The CfnDomain object was retrieved from a CfnInclude object. Here's the snippet of code that's failing for me.Reproduction Steps
Here's some minimal code that causes the bug.
What did you expect to happen?
The error shouldn't happen and the Domain object should be successfully created.
What actually happened?
Environment
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: