(aws-eks): OnEventHandler deploymnet fails in simple cluster "Uploaded file must be a non-empty zip"
An simple demo EKS doesn't deploy in fresh project. The step which fails is the in the nested stack by the EKS module
3:14:57 PM | CREATE_FAILED | AWS::CloudFormation::Stack | @aws-cdk--aws-eks....estedStackResource
Embedded stack arn:aws:cloudformation:eu-central-1:<accid>:stack/EksStack-awscdkawseksClusterResourceProviderNestedSt
ackawscdkawseksClusterResourceProv-21L6MXXZRYUI/ceb2c420-6560-11eb-9f1d-02d4c868af5c was not successfully created: The fol
lowing resource(s) failed to create: [OnEventHandler42BEBAE0, IsCompleteHandler7073F4DA].
Nested Stack reveals:
Uploaded file must be a non-empty zip (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 3063a7a7-6144-41cd-b9bd-95d773c35f76; Proxy: null)
Uploaded file must be a non-empty zip (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 2ceb2c07-1eae-475c-a52f-d0be62a407b2; Proxy: null)
Reproduction Steps
mkdir demo
cd demo
cdk init app --language typescript
npm install @aws-cdk/aws-eks
cdk bootstrap aws://<account id>/<region>
Update the DemoStack:
import * as cdk from '@aws-cdk/core';
import * as eks from '@aws-cdk/aws-eks';
export class DemoStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const cluster = new eks.Cluster(this, 'eks-cluster', {
version: eks.KubernetesVersion.V1_18,
});
}
}
Deploy
cdk deploy DemoStack
What did you expect to happen?
A successful deployed eks control plane.
What actually happened?
The deployment is roled back.
Environment
- CDK CLI Version : 1.87.1 (build 9eeaa93)
- Framework Version:
- Node.js Version: 7.4.3
- OS : macOS Catalina 10.15.7
- Language (Version): Typescript
Other
- the staging bucket / asset folder was empty before the deployment and contains several zips to be deployed in the process
This is :bug: Bug Report
Deleting node with all modules, restart of the machine and a fresh installing node and cdk fixed this issue.
⚠️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.
Related to https://github.com/aws/aws-cdk/issues/12536
Hi folks 👋 I seem to be running into this issue as well trying to upgrade from CDK 2.32.1 to 2.33.0, despite following recommendations here: https://github.com/aws/aws-cdk/issues/12828#issuecomment-771763631
CDK CLI Version: 2.32.0 Framework Version: 2.32.0 Node.js Version: 14.18.3 OS : macOS Catalina 11.5.2 Language (Version): Typescript
From what I can tell the CDK isn't able to generate the assets it needs for the cluster OIDC provider lambda; normally there would be these files in the generated asset folder for the lambda:
| asset.f7f53a92c36d534d2a91a241257f20f748d85f700dac48fafe14bfdbc36eaad5
| diff.js
| diff.d.ts
| external.d.ts
| external.js
| index.d.ts
| index.js
where for example external.d.ts would have contents like this:
import * as aws from 'aws-sdk';
declare function defaultLogger(fmt: string, ...args: any[]): void;
/**
* Downloads the CA thumbprint from the issuer URL
*/
declare function downloadThumbprint(issuerUrl: string): Promise<string>;
export declare const external: {
downloadThumbprint: typeof downloadThumbprint;
log: typeof defaultLogger;
createOpenIDConnectProvider: (req: aws.IAM.CreateOpenIDConnectProviderRequest) => Promise<import("aws-sdk/lib/request").PromiseResult<aws.IAM.CreateOpenIDConnectProviderResponse, aws.AWSError>>;
deleteOpenIDConnectProvider: (req: aws.IAM.DeleteOpenIDConnectProviderRequest) => Promise<{
$response: aws.Response<{}, aws.AWSError>;
}>;
updateOpenIDConnectProviderThumbprint: (req: aws.IAM.UpdateOpenIDConnectProviderThumbprintRequest) => Promise<{
$response: aws.Response<{}, aws.AWSError>;
}>;
addClientIDToOpenIDConnectProvider: (req: aws.IAM.AddClientIDToOpenIDConnectProviderRequest) => Promise<{
$response: aws.Response<{}, aws.AWSError>;
}>;
removeClientIDFromOpenIDConnectProvider: (req: aws.IAM.RemoveClientIDFromOpenIDConnectProviderRequest) => Promise<{
$response: aws.Response<{}, aws.AWSError>;
}>;
};
export {};
However when I run cdk diff with 2.33.0, the CLI just hangs after only generating the new asset folder and __entrypoint__.js, which is also entirely empty:
| asset.494e82802f093e633e580188c7937aef9d6ee0ad4a788d58c647e6bea26d2915
| __entrypoint.js__
There's not much output to share, even when setting -vvv --debug; it just seems like the CDK can't generate the assets it needs for the deploy. I've deleted cdk.out several times, I've been sure to clear the uploaded assets from the s3 staging bucket, I've deleted and re-installed node_modules, and I've also uninstalled and re-installed node 14.18.3. Unfortunately none of this has resolved the issue. The only way I can get the stack to generate a diff and run a deploy is if I downgrade the cdk back to 2.32.1.
Hoping to get some clarity on what my next steps might be here 🙏 Posting what output I do get before the cdk diff hangs and doesn't proceed further:
CDK toolkit version: 2.33.0 (build 859272d)
Command line arguments: {
_: [ 'diff' ],
v: 3,
verbose: 3,
debug: true,
app: 'npx ts-node bin/$npm_config_app',
a: 'npx ts-node bin/$npm_config_app',
newBootstrap: 1,
lookups: true,
'ignore-errors': false,
ignoreErrors: false,
json: false,
j: false,
ec2creds: undefined,
i: undefined,
'version-reporting': undefined,
versionReporting: undefined,
'path-metadata': true,
pathMetadata: true,
'asset-metadata': true,
assetMetadata: true,
'role-arn': undefined,
r: undefined,
roleArn: undefined,
staging: true,
'no-color': false,
noColor: false,
ci: false,
'context-lines': 3,
contextLines: 3,
strict: false,
'security-only': false,
securityOnly: false,
processed: false,
'$0': 'node_modules/.bin/cdk',
STACKS: [ '*' ],
'S-t-a-c-k-s': [ '*' ]
}
cdk.json: {
"context": {
"@aws-cdk/core:stackRelativeExports": "true"
}
}
merged settings: {
versionReporting: true,
pathMetadata: true,
output: 'cdk.out',
context: { '@aws-cdk/core:stackRelativeExports': 'true' },
app: 'npx ts-node bin/$npm_config_app',
debug: true,
assetMetadata: true,
toolkitBucket: {},
staging: true,
bundlingStacks: [ '*' ],
lookups: true
}
Determining if we're on an EC2 instance.
Does not look like an EC2 instance.
Toolkit stack: CDKToolkit
Setting "CDK_DEFAULT_REGION" environment variable to us-east-1
Resolving default credentials
Looking up default account ID from STS
Notices refreshed
Failed to store notices in the cache: Error: ENOENT: no such file or directory, open '/root/.cdk/cache/notices.json'
[AWS sts 200 0.213s 0 retries] getCallerIdentity({})
Default account ID: <acct-id>
Setting "CDK_DEFAULT_ACCOUNT" environment variable to <acct-id>
context: {
'@aws-cdk/core:stackRelativeExports': 'true',
'aws:cdk:enable-path-metadata': true,
'aws:cdk:enable-asset-metadata': true,
'aws:cdk:version-reporting': true,
'aws:cdk:bundling-stacks': [ '*' ]
}
outdir: cdk.out
env: {
CDK_DEFAULT_REGION: 'us-east-1',
CDK_DEFAULT_ACCOUNT: <acct-id>,
CDK_DEBUG: 'true',
CDK_CONTEXT_JSON: '{"@aws-cdk/core:stackRelativeExports":"true","aws:cdk:enable-path-metadata":true,"aws:cdk:enable-asset-metadata":true,"aws:cdk:version-reporting":true,"aws:cdk:bundling-stacks":["*"]}',
CDK_OUTDIR: 'cdk.out',
CDK_CLI_ASM_VERSION: '20.0.0',
CDK_CLI_VERSION: '2.33.0'
}