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

custom-resource: installLatestAwsSdk could timeout in China regions #27597

Closed
pahud opened this issue Oct 18, 2023 · 4 comments
Closed

custom-resource: installLatestAwsSdk could timeout in China regions #27597

pahud opened this issue Oct 18, 2023 · 4 comments
Labels
@aws-cdk/custom-resources Related to AWS CDK Custom Resources bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@pahud
Copy link
Contributor

pahud commented Oct 18, 2023

Describe the bug

This function triggers a straight npm install which generally would timeout in China regions.

This is not a bug we just need some workaround for it.

Expected Behavior

installLatestSdk would not timeout

Current Behavior

would timeout

Reproduction Steps

set installLatestAwsSdk to true in custom resource

Workaround

Set installLatestAwsSdk: false or the feature flag @aws-cdk/customresources:installLatestAwsSdkDefault to false.

See: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.custom_resources.AwsCustomResource.html#installlatestawssdk

Possible Solution

I guess China users might need to use npm proxy or alternative mirrors to work it around.

Additional Information/Context

No response

CDK CLI Version

2.100.0

Framework Version

No response

Node.js Version

v18.16.0

OS

linux

Language

TypeScript

Language Version

No response

Other information

No response

@pahud pahud added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 18, 2023
@github-actions github-actions bot added the @aws-cdk/custom-resources Related to AWS CDK Custom Resources label Oct 18, 2023
@pahud pahud changed the title custom-resource: installLatestSdk could timeout in China regions custom-resource: installLatestAwsSdk could timeout in China regions Oct 18, 2023
@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Oct 18, 2023
@pahud
Copy link
Contributor Author

pahud commented Oct 18, 2023

loop @zxkane

@zxkane
Copy link
Contributor

zxkane commented Oct 19, 2023

If you are not using AwsCustomResource to directly call APIs without your custom code, you can use NodejsFunction to bundle the specific SDK within your lambda.

mergify bot pushed a commit that referenced this issue Jan 12, 2024
… to install latest sdk version (#28688)

This introduced uncertainty into the resource behavior, adds at least 60s to the execution time and will cause deployments in CN regions to fail.

No tests add because the existing tests run with the `@aws-cdk/customresources:installLatestAwsSdkDefault` feature flag set to the recommended value. This change is merely change the `OpenSearchAccessPolicy` config for users that don't set the feature flag. We can safely do this, because we control the code for this custom resource and know it works with the provided SDK version.

Related to #27597

----

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

pahud commented Apr 15, 2024

I've confirmed this issue doesn't exist in cn-north-1 and cn-northwest-1 anymore with the following code.

import {
  App, Stack,
  aws_eks as eks,
  aws_ec2 as ec2,
  aws_iam as iam,
} from 'aws-cdk-lib';

import { KubectlV29Layer } from '@aws-cdk/lambda-layer-kubectl-v29';

const app = new App();

const stack = new Stack(app, 'my-test-stack4');

const mastersRole = new iam.Role(stack, 'AdminRole', {
  assumedBy: new iam.AccountRootPrincipal(),
});

const vpc = new ec2.Vpc(stack, 'Vpc', { natGateways: 1 });

new eks.Cluster(stack, 'Cluster', {
  vpc,
  mastersRole,
  version: eks.KubernetesVersion.V1_29,
  kubectlLayer: new KubectlV29Layer(stack, 'KubectlLayer'),
  defaultCapacity: 2,
});

@aws-cdk/customresources:installLatestAwsSdkDefault is now default to false since 2.60.0.

@pahud pahud closed this as completed Apr 15, 2024
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/custom-resources Related to AWS CDK Custom Resources bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

No branches or pull requests

2 participants