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-alpha): custom-resource-handler not found #28089

Closed
tmokmss opened this issue Nov 21, 2023 · 5 comments · Fixed by #28658
Closed

(amplify-alpha): custom-resource-handler not found #28089

tmokmss opened this issue Nov 21, 2023 · 5 comments · Fixed by #28658
Labels
@aws-cdk/aws-amplify Related to AWS Amplify bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@tmokmss
Copy link
Contributor

tmokmss commented Nov 21, 2023

Describe the bug

I get the below error on cdk synth using amplifyApp.addBranch(...). See the reproduction code below.

Error: Cannot find entry file at /root/cdk/node_modules/@aws-cdk/custom-resource-handlers/dist/aws-amplify-alpha/asset-deployment-handler/index.js
    at findEntry (/root/cdk/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/function.js:1:3405)
    at new NodejsFunction (/root/cdk/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/function.js:1:1391)
    at new AmplifyAssetDeploymentProvider (/root/cdk/node_modules/@aws-cdk/aws-amplify-alpha/lib/branch.ts:232:21)
    at Function.getOrCreate (/root/cdk/node_modules/@aws-cdk/aws-amplify-alpha/lib/branch.ts:223:82)
    at new Branch (/root/cdk/node_modules/@aws-cdk/aws-amplify-alpha/lib/branch.ts:190:54)
    at App.addBranch (/root/cdk/node_modules/@aws-cdk/aws-amplify-alpha/lib/app.ts:303:12)
    at new CdkStack (/root/cdk/lib/cdk-stack.ts:17:24)
    at Object.<anonymous> (/root/cdk/bin/cdk.ts:7:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module.m._compile (/root/cdk/node_modules/ts-node/src/index.ts:1618:23)

Subprocess exited with error 1

Expected Behavior

cdk synth successes

Current Behavior

the above error happens on cdk synth

Reproduction Steps

Run cdk synth with the below code:

import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as amplify from '@aws-cdk/aws-amplify-alpha';
import { Asset } from 'aws-cdk-lib/aws-s3-assets';

export class CdkStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const asset = new Asset(this, 'Frontend', {
      path: './cdk.json',
    });
    const app = new amplify.App(this, 'MyApp', {
      platform: amplify.Platform.WEB_COMPUTE,
    });
    const branch = app.addBranch('dev', { asset: asset });
  }
}

Possible Solution

No response

Additional Information/Context

#27955 seems related to this. Maybe the relative directory structure differs from the expectation? (given that alpha modules are installed on a special location (node_modules/@aws-cdk/aws-amplify-alpha)

CDK CLI Version

2.110.0

Framework Version

No response

Node.js Version

v18.13.0

OS

macOS

Language

TypeScript

Language Version

No response

Other information

No response

@tmokmss tmokmss added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 21, 2023
@github-actions github-actions bot added the @aws-cdk/aws-amplify Related to AWS Amplify label Nov 21, 2023
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Nov 21, 2023
@khushail khushail self-assigned this Nov 21, 2023
@khushail
Copy link
Contributor

Thanks @tmokmss for reporting this.

@khushail khushail added the p2 label Nov 22, 2023
@khushail khushail removed their assignment Nov 22, 2023
@khushail khushail added effort/medium Medium work item – several days of effort and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Nov 22, 2023
@jaismith
Copy link

Also encountering this issue, any ETA on when this will be prioritized?

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.

1 similar comment
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.

@bogdanvaduva9
Copy link

image
Also getting a similar issue with these libraries:

    "aws-cdk-lib": "2.121.1",
    "constructs": "^10.0.0"

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

Successfully merging a pull request may close this issue.

4 participants