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

Amplify CLI Custom CDK - Cannot read properties of undefined (reading 'category') #13138

Closed
2 tasks done
samturner3 opened this issue Aug 18, 2023 · 9 comments
Closed
2 tasks done
Labels
custom-cdk Issues related to custom CDK resource functionality pending-triage Issue is pending triage

Comments

@samturner3
Copy link

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

v16.16.0

Amplify CLI Version

12.2.4

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

Describe the bug

When building or pushing a custom resource CDK stack, get error Cannot read properties of undefined (reading 'category') when using basic example code.

Screen Shot 2023-08-18 at 12 02 20 pm

Expected behavior

Expected to build successfully.

Reproduction steps

  1. Run amplify add custom -> AWS CDK
  2. In the generated AWS CDK code, uncomment the example on accessing other Amplify Resources:
    // Access other Amplify Resources 
    const retVal:AmplifyDependentResourcesAttributes = AmplifyHelpers.addResourceDependency(this, 
      amplifyResourceProps.category, 
      amplifyResourceProps.resourceName, 
      [
        {category: <insert-amplify-category>, resourceName: <insert-amplify-resourcename>},
      ]
    );
  1. Insert a function that is in your resources. ie for me: { category: 'function', resourceName: 'fetchFlightsFn' }
  2. Save file and run amplify push

Project Identifier

d7b341914af3ff80145ba75e9ea4eb36

Log output

# Put your logs below this line

2023-08-17T14:16:10.271Z|info : amplify push core  
2023-08-17T14:16:10.312Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-17T14:16:14.406Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2023-08-17T14:16:14.407Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:16:14.680Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:16:15.917Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:16:16.129Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:16:16.255Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]tssearch-[***]1SFQMF/[***]6b10-[***]ee-[***]ee-[***]d8-[***]5a2d8"}])
2023-08-17T14:16:16.257Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]atssearch-[***]66OWT/[***]0cd0-[***]ee-[***]ee-[***]b8-[***]6f072"}])
2023-08-17T14:16:16.259Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ghtsVirginAu-[***]NEYSZX/[***]fbd0-[***]01-[***]ee-[***]3a-[***]35f72"}])
2023-08-17T14:16:16.387Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:16:31.476Z|error : There was an error building the custom resources
InvalidCustomResourceError: There was an error building the custom resources
2023-08-17T14:33:40.196Z|info : amplify push core  
2023-08-17T14:33:40.238Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-17T14:33:44.473Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2023-08-17T14:33:44.475Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:33:44.743Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:33:45.854Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:33:46.011Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:33:46.134Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]tssearch-[***]1SFQMF/[***]6b10-[***]ee-[***]ee-[***]d8-[***]5a2d8"}])
2023-08-17T14:33:46.136Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]atssearch-[***]66OWT/[***]0cd0-[***]ee-[***]ee-[***]b8-[***]6f072"}])
2023-08-17T14:33:46.138Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ghtsVirginAu-[***]NEYSZX/[***]fbd0-[***]01-[***]ee-[***]3a-[***]35f72"}])
2023-08-17T14:33:46.270Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:34:00.887Z|error : There was an error building the custom resources
InvalidCustomResourceError: There was an error building the custom resources
2023-08-17T14:34:33.896Z|info : amplify push core  
2023-08-17T14:34:33.939Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-17T14:34:37.442Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2023-08-17T14:34:37.444Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:34:37.689Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:34:38.861Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:34:39.034Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:34:39.162Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]tssearch-[***]1SFQMF/[***]6b10-[***]ee-[***]ee-[***]d8-[***]5a2d8"}])
2023-08-17T14:34:39.163Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]atssearch-[***]66OWT/[***]0cd0-[***]ee-[***]ee-[***]b8-[***]6f072"}])
2023-08-17T14:34:39.165Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ghtsVirginAu-[***]NEYSZX/[***]fbd0-[***]01-[***]ee-[***]3a-[***]35f72"}])
2023-08-17T14:34:39.302Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:34:50.668Z|error : There was an error building the custom resources
InvalidCustomResourceError: There was an error building the custom resources
2023-08-17T14:37:35.498Z|info : amplify version core  {"version":true,"yes":false}
2023-08-17T14:41:41.420Z|info : amplify push core  
2023-08-17T14:41:41.471Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-17T14:41:45.486Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2023-08-17T14:41:45.488Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:41:45.764Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:41:46.609Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:41:46.770Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:41:46.897Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]tssearch-[***]1SFQMF/[***]6b10-[***]ee-[***]ee-[***]d8-[***]5a2d8"}])
2023-08-17T14:41:46.899Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]atssearch-[***]66OWT/[***]0cd0-[***]ee-[***]ee-[***]b8-[***]6f072"}])
2023-08-17T14:41:46.900Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ghtsVirginAu-[***]NEYSZX/[***]fbd0-[***]01-[***]ee-[***]3a-[***]35f72"}])
2023-08-17T14:41:47.033Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:42:02.024Z|error : There was an error building the custom resources
InvalidCustomResourceError: There was an error building the custom resources
2023-08-17T14:46:53.447Z|info : amplify push core  
2023-08-17T14:46:53.491Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-17T14:46:57.719Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2023-08-17T14:46:57.721Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:46:57.977Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:46:59.053Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:46:59.210Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:46:59.334Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]tssearch-[***]1SFQMF/[***]6b10-[***]ee-[***]ee-[***]d8-[***]5a2d8"}])
2023-08-17T14:46:59.336Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]atssearch-[***]66OWT/[***]0cd0-[***]ee-[***]ee-[***]b8-[***]6f072"}])
2023-08-17T14:46:59.338Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ghtsVirginAu-[***]NEYSZX/[***]fbd0-[***]01-[***]ee-[***]3a-[***]35f72"}])
2023-08-17T14:46:59.468Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:47:14.699Z|error : There was an error building the custom resources
InvalidCustomResourceError: There was an error building the custom resources
2023-08-17T14:47:44.353Z|info : amplify remove custom  
2023-08-17T14:47:44.391Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-17T14:48:00.216Z|info : amplify add custom  
2023-08-17T14:48:00.256Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-17T14:49:20.897Z|info : amplify push core  
2023-08-17T14:49:20.939Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-17T14:49:24.662Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2023-08-17T14:49:24.664Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:49:24.951Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:49:26.104Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:49:26.263Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:49:26.384Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]tssearch-[***]1SFQMF/[***]6b10-[***]ee-[***]ee-[***]d8-[***]5a2d8"}])
2023-08-17T14:49:26.385Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]atssearch-[***]66OWT/[***]0cd0-[***]ee-[***]ee-[***]b8-[***]6f072"}])
2023-08-17T14:49:26.387Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ghtsVirginAu-[***]NEYSZX/[***]fbd0-[***]01-[***]ee-[***]3a-[***]35f72"}])
2023-08-17T14:49:26.513Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:51:24.240Z|info : amplify push core  
2023-08-17T14:51:24.284Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-17T14:51:27.449Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2023-08-17T14:51:27.450Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:51:27.787Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:51:28.882Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:51:29.051Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-17T14:51:29.177Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]tssearch-[***]1SFQMF/[***]6b10-[***]ee-[***]ee-[***]d8-[***]5a2d8"}])
2023-08-17T14:51:29.179Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]atssearch-[***]66OWT/[***]0cd0-[***]ee-[***]ee-[***]b8-[***]6f072"}])
2023-08-17T14:51:29.180Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ghtsVirginAu-[***]NEYSZX/[***]fbd0-[***]01-[***]ee-[***]3a-[***]35f72"}])
2023-08-17T14:51:29.321Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-17T14:51:40.403Z|error : There was an error building the custom resources
InvalidCustomResourceError: There was an error building the custom resources
2023-08-18T01:42:29.409Z|info : amplify build core  
2023-08-18T01:42:29.455Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-18T01:44:10.492Z|info : amplify push core  
2023-08-18T01:44:10.543Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-18T01:44:15.089Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2023-08-18T01:44:15.091Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-18T01:44:15.376Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-18T01:44:16.688Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-18T01:44:16.858Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-18T01:44:17.007Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]tssearch-[***]1SFQMF/[***]6b10-[***]ee-[***]ee-[***]d8-[***]5a2d8"}])
2023-08-18T01:44:17.009Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]atssearch-[***]66OWT/[***]0cd0-[***]ee-[***]ee-[***]b8-[***]6f072"}])
2023-08-18T01:44:17.011Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ghtsVirginAu-[***]NEYSZX/[***]fbd0-[***]01-[***]ee-[***]3a-[***]35f72"}])
2023-08-18T01:44:17.153Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-18T01:44:29.234Z|error : There was an error building the custom resources
InvalidCustomResourceError: There was an error building the custom resources
2023-08-18T01:46:10.191Z|info : amplify version core  
2023-08-18T01:51:03.596Z|info : amplify diagnose core  {"send-report":true,"yes":false}
2023-08-18T01:51:03.643Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-18T02:01:39.993Z|info : amplify push core  
2023-08-18T02:01:40.068Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2023-08-18T02:01:44.138Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2023-08-18T02:01:44.140Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-18T02:01:44.413Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-18T02:01:45.704Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-18T02:01:45.883Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]8b158cb4-[***]ing-[***]556"}])
2023-08-18T02:01:46.014Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]tssearch-[***]1SFQMF/[***]6b10-[***]ee-[***]ee-[***]d8-[***]5a2d8"}])
2023-08-18T02:01:46.015Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]atssearch-[***]66OWT/[***]0cd0-[***]ee-[***]ee-[***]b8-[***]6f072"}])
2023-08-18T02:01:46.017Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]rmation:ap-[***]east-[***]53:stack/[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ghtsVirginAu-[***]NEYSZX/[***]fbd0-[***]01-[***]ee-[***]3a-[***]35f72"}])
2023-08-18T02:01:46.144Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]8b158cb4-[***]ing-[***]556-[***]ment"}])
2023-08-18T02:02:00.647Z|error : There was an error building the custom resources
InvalidCustomResourceError: There was an error building the custom resources
2023-08-18T02:02:08.182Z|info : amplify build core  
2023-08-18T02:02:08.223Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}


Additional information

I think this is very similar to #13122.
There the suggested fix is to use specific versions. My versions in amplify/backend/custom/customResource7f1c64f3/package.json

{
  "name": "custom-resource",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "build": "tsc",
    "watch": "tsc -w",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {
    "@aws-amplify/cli-extensibility-helper": "^3.0.14",
    "aws-cdk-lib": "~2.80.0",
    "constructs": "^10.2.69"
  },
  "devDependencies": {
    "typescript": "^5.1.6"
  }
}

I have set them the same as the other issue suggests but still encounter the issue.
Is there a build/install step that needs to be performed when editing this? Or is running amplify build / amplify push the correct steps?

Related Eslint issue

Also when I enable TS eslint linting on the file (amplify/backend/custom/customResource7f1c64f3/cdk-stack.ts) including the rule @typescript-eslint/prefer-nullish-coalescing and enable "strictNullChecks": true in tsconfig.json, I get warnings that 'amplifyResourceProps' is possibly 'undefined'.. Which is interestingly related to the console error :Cannot read properties of undefined (reading 'category')

Screen Shot 2023-08-18 at 11 57 16 am

So I then made amplifyResourceProps non-nullable (remove the ?) which makes the eslint error go away.

Screen Shot 2023-08-18 at 11 58 54 am

However after this the error still exists on amplify push.

I have been battling with this for days and tried many examples online only to be blocked by this issue over and over again. 😢

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@samturner3 samturner3 added the pending-triage Issue is pending triage label Aug 18, 2023
@samturner3
Copy link
Author

samturner3 commented Aug 18, 2023

I have been using these resources as a guide, still with the error.

Essentially trying to implement a step function invoked by the graphql api I have on my project, with a lambda function as the first step.

@ykethan ykethan added the custom-cdk Issues related to custom CDK resource functionality label Aug 18, 2023
@ykethan
Copy link
Contributor

ykethan commented Aug 18, 2023

Hey @samturner3, thank you for reaching out, I was able to reproduce the issue. We are currently looking into a workaround, tried removing the node modules ,yarn.lock and then build which did not mitigate the issue.

Reproduction steps:

  1. amplify add custom
  2. which created the following package.json
{
  "name": "custom-resource",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "build": "tsc",
    "watch": "tsc -w",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {
    "@aws-amplify/cli-extensibility-helper": "^3.0.0",
    "aws-cdk-lib": "~2.80.0",
    "constructs": "^10.0.5"
  },
  "devDependencies": {
    "typescript": "^4.9.5"
  }
}
  1. replace with the following
{
  "name": "custom-resource",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "build": "tsc",
    "watch": "tsc -w",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {
    "@aws-amplify/cli-extensibility-helper": "^3.0.0",
    "aws-cdk-lib": "~2.92.0",
    "constructs": "^10.2.69"
  },
  "devDependencies": {
    "typescript": "^5.1.6"
  }
}
  1. run amplify build and observe error. Also changed the "@aws-amplify/cli-extensibility-helper": "^3.0.14" which did not mitigate it.

however, removing the custom resource entirely amplify remove custom, then amplify add custom and modify the package.json with

{
  "name": "custom-resource",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "build": "tsc",
    "watch": "tsc -w",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {
    "@aws-amplify/cli-extensibility-helper": "^3.0.14",
    "aws-cdk-lib": "~2.80.0",
    "constructs": "^10.2.69"
  },
  "devDependencies": {
    "typescript": "^5.1.6"
  }
}

running build did not throw any errors

@ykethan ykethan added the investigating This issue is being investigated label Aug 18, 2023
@ykethan
Copy link
Contributor

ykethan commented Aug 18, 2023

@samturner3 noticed some additional information. Does the custom resource folder have a tsconfig.json file similar to following.

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "strict": false,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "outDir": "build"
  }
}

if not, could you create file with the above contents and build the project amplify build?

@ykethan ykethan added pending-response Issue is pending response from the issue author and removed investigating This issue is being investigated labels Aug 18, 2023
@samturner3
Copy link
Author

@samturner3 noticed some additional information. Does the custom resource folder have a tsconfig.json file similar to following.

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "strict": false,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "outDir": "build"
  }
}

if not, could you create file with the above contents and build the project amplify build?

I followed your instructions (amplify remove custom, then amplify add custom and modify the package.json), and now builds.

Yes It does have a tsconfig.json with those contents.

I'll continue restoring my code and see if I run into any more issues.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Aug 19, 2023
@samturner3
Copy link
Author

samturner3 commented Aug 21, 2023

This error is again popping up with the correct package.json config.
I really don't want to remove and add my custom component everytime this happens, especially when in production. What is fix here?

Even the force -f flag does not get past it.

@ykethan
Copy link
Contributor

ykethan commented Aug 21, 2023

Hey @samturner3, could you provide us the output by running amplify push --debug?
Additionally, I was able to reproduce the issue by adding the @typescript-eslint/prefer-nullish-coalescing and "strictNullChecks": true in tsconfig.json.
Could you try removing the options and run amplify build --debug and observe if the undefined error does not appears in cdk-stack.ts?

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Aug 21, 2023
@samturner3
Copy link
Author

I am hesitant to do any more testing on my project as it seems to be working ok now.
From memory yes adding the tsconfig and eslint rules made it pop up again. I have removed / disabled these rules for now on my project.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Aug 24, 2023
@ykethan
Copy link
Contributor

ykethan commented Aug 24, 2023

I understand, please feel in reaching out to us again if you need any further assistance.
Closing the issue.

@ykethan ykethan closed this as not planned Won't fix, can't repro, duplicate, stale Aug 24, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please 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
custom-cdk Issues related to custom CDK resource functionality pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

2 participants