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

Fix: support aws-cdk>=2.177.0 #107

Merged
merged 6 commits into from
Feb 4, 2025
Merged

Conversation

simonrw
Copy link
Contributor

@simonrw simonrw commented Jan 31, 2025

Motivation

Addresses #106

The CDK team have recently made a change to not export some internal types of the aws-cdk package. We rely on these types to override the endpoint url to point to LocalStack. This therefore broke our integration with the CDK.

Changes

  • Detect when aws-cdk>=2.177.0 is installed, and instead use the AWS_ENDPOINT_URL and AWS_ENDPOINT_URL_S3 environment variables to configure the JavaScript SDKs

@simonrw simonrw self-assigned this Jan 31, 2025
@simonrw simonrw marked this pull request as ready for review February 4, 2025 17:13
Comment on lines +455 to +456
// This _must_ use localhost.localstack.cloud as we require valid subdomains of these paths to
// resolve. Unfortunately though `curl` seems to support subdomains of localhost, the CDK does not.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So s3.localhost didn't work for you with cdklocal but s3.localhost.localstack.cloud did? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup unfortunately. I think it depends on the dns resolver and tool making the dns query, so sometimes it works and sometimes it doesn't depending on the tool.

@dominikschubert dominikschubert self-requested a review February 4, 2025 19:43
Copy link
Member

@dominikschubert dominikschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for adding proper documentation around which aws-cdk version introduced the change that broke compatibility with cdklocal! I'm curious to hear more about your reasoning around using localhost.localstack.cloud vs. localhost but I think we can go ahead and release this to unblock cdklocal users 🚀

@dominikschubert dominikschubert merged commit 7400aa3 into main Feb 4, 2025
21 checks passed
@dominikschubert dominikschubert deleted the fix/cdklocal/aws-cdk-2177 branch February 4, 2025 19:45
const configureEnvironment = () => {
// This _must_ use localhost.localstack.cloud as we require valid subdomains of these paths to
// resolve. Unfortunately though `curl` seems to support subdomains of localhost, the CDK does not.
process.env.AWS_ENDPOINT_URL_S3 = process.env.AWS_ENDPOINT_URL_S3 || `${PROTOCOL}://s3.localhost.localstack.cloud:${EDGE_PORT}`;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to share, but by default, we are also using s3.localhost.localstack.cloud for tflocal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants