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

CLI hangs with "unexpected: --output is required" (is it related to NodejsFunction?) #8921

Closed
th3r10n opened this issue Jul 7, 2020 · 19 comments
Assignees
Labels

Comments

@th3r10n
Copy link

th3r10n commented Jul 7, 2020

After adding a NodejsFunction construct to my stack and having succesfully
controller.zip

Reproduction Steps

Error Log

Environment

  • CLI Version :
  • Framework Version:
  • Node.js Version:
  • OS :
  • Language (Version):

Other


This is 🐛 Bug Report

@th3r10n th3r10n added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 7, 2020
@eladb
Copy link
Contributor

eladb commented Jul 7, 2020

Please run with —verbose and pasting your output?

Copy @jogold

@th3r10n
Copy link
Author

th3r10n commented Jul 7, 2020

CDK toolkit version: 1.49.1 (build 7d6321f)
Command line arguments: {
  _: [ 'synth' ],
  v: 1,
  verbose: 1,
  e: true,
  exclusively: true,
  r: undefined,
  'role-arn': undefined,
  roleArn: undefined,
  b: true,
  o: '',
  output: '',
  s: 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,
  staging: true,
  'no-color': false,
  noColor: false,
  fail: false,
  '$0': 'cdk'
}
cdk.json: {
  "app": "npx ts-node bin/controller.ts",
  "context": {
    "@aws-cdk/core:enableStackNameDuplicates": "true",
    "aws-cdk:enableDiffNoFail": "true"
  }
}
merged settings: {
  versionReporting: true,
  pathMetadata: true,
  output: '',
  app: 'npx ts-node bin/controller.ts',
  context: {
    '@aws-cdk/core:enableStackNameDuplicates': 'true',
    'aws-cdk:enableDiffNoFail': 'true'
  },
  tags: [],
  assetMetadata: true,
  toolkitBucket: {},
  staging: true
}
Determining whether we're on an EC2 instance.
Does not look like EC2 instance.
Toolkit stack: CDKToolkit
Setting "CDK_DEFAULT_REGION" environment variable to us-west-2
Resolving default credentials
Retrieved account ID 905871336375 from disk cache
Setting "CDK_DEFAULT_ACCOUNT" environment variable to 905871336375
context: {
  '@aws-cdk/core:enableStackNameDuplicates': 'true',
  'aws-cdk:enableDiffNoFail': 'true',
  'aws:cdk:enable-path-metadata': true,
  'aws:cdk:enable-asset-metadata': true
}
unexpected: --output is required
Error: unexpected: --output is required
    at Object.execProgram (/usr/local/lib/node_modules/aws-cdk/lib/api/cxapp/exec.ts:60:11)
    at CloudExecutable.doSynthesize (/usr/local/lib/node_modules/aws-cdk/lib/api/cxapp/cloud-executable.ts:66:24)
    at CloudExecutable.synthesize (/usr/local/lib/node_modules/aws-cdk/lib/api/cxapp/cloud-executable.ts:52:29)
    at CdkToolkit.selectStacksForDiff (/usr/local/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:398:22)
    at CdkToolkit.synth (/usr/local/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:298:20)
    at main (/usr/local/lib/node_modules/aws-cdk/bin/cdk.ts:279:16)
    at initCommandLine (/usr/local/lib/node_modules/aws-cdk/bin/cdk.ts:185:9)

@jogold
Copy link
Contributor

jogold commented Jul 7, 2020

@eladb the error seems to originate from here:

if (!outdir) {
throw new Error('unexpected: --output is required');
}

any idea what might cause this and how it could be related to the NodejsFunction construct?

@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Jul 7, 2020
@eladb
Copy link
Contributor

eladb commented Jul 8, 2020

For some reason, the output switch in the CLI is an empty string ("") instead of cdk.out. @th3r10n can you also include the exact command line you are executing? Also, can you try to pass -o cdk.out to the CLI?

@eladb eladb changed the title [lambda-nodejs] AWS CDK TypeScript project. "cdk synth/deploy hangs when there is a NodejsFunction construct in the stack. CLI hangs with "unexpected: --output is required" (is it related to NodejsFunction?) Jul 8, 2020
@th3r10n
Copy link
Author

th3r10n commented Jul 9, 2020

@eladb,

The output of executing "cdk synth -verbose": cdk-synth-verbose.txt

The output of executing "cdk synth -verbose -o cdk.out": cdk-synth-verbose-output.txt

@jogold
Copy link
Contributor

jogold commented Jul 9, 2020

@th3r10n and you don't get the unexpected: --output is required error when removing the NodejsFunction construct?

Would be great if you could share a GitHub repo to reproduce this.

@th3r10n
Copy link
Author

th3r10n commented Jul 10, 2020

@jogold ,

If I remove the NodejsFunction construct I get:

The output of executing "cdk synth -verbose": cdk-synth-verbose-no-function.txt

The output of executing "cdk synth -verbose -o cdk.out": cdk-synth-verbose-output-no-function.txt

However, without the above mentioned construct, "cdk synth" works fine.

The GitHub repo with the code is available here: https://github.com/th3r10n/controller.git

@jogold
Copy link
Contributor

jogold commented Jul 10, 2020

The GitHub repo with the code is available here: th3r10n/controller.git

This is an empty project. I don't see any NodejsFunction in there. Do you have issues synthesizing or deploying it?

@th3r10n
Copy link
Author

th3r10n commented Jul 11, 2020

@jogold ,

My mistake, I've populated the repo now.

I have problems to synthesize it.

@jogold
Copy link
Contributor

jogold commented Jul 13, 2020

My mistake, I've populated the repo now.

The code currently doesn't reference any NodejsFunction constructs. Also it fails because you're pointing to a non-existing lambda directory in the GetProductsHandler function.

@th3r10n
Copy link
Author

th3r10n commented Jul 14, 2020

@jogold ,

The NodeJSFunction is in line 53 of controller-stack.ts(commented out to make it work). I've added the missing js files referenced in the code.

Be that as it may. I let the cdk synth/deploy commands just hang there, turns out they are returning successfully but only after a long time compared to when the NodeJSFunction construct is not present.

@jogold
Copy link
Contributor

jogold commented Jul 14, 2020

@th3r10n just pulled the latest version of your repo.

$ time npm run cdk synth
real    0m7.170s
user    0m4.661s
sys     0m0.286s

image

Can you detail your OS/Docker setup maybe?

@eladb
Copy link
Contributor

eladb commented Jul 16, 2020

What's the status here @jogold ?

@eladb eladb added the p2 label Jul 16, 2020
@jogold
Copy link
Contributor

jogold commented Jul 16, 2020

What's the status here @jogold ?

I was able to successfully synthesize...

turns out they are returning successfully but only after a long time compared to when the NodeJSFunction construct is not present.

@th3r10n how long? only on the first run? The first run could take more time if the bundling Docker image is not already built and cached.

@th3r10n
Copy link
Author

th3r10n commented Jul 20, 2020

@jogold ,

If the NodeJSFunction is present, its taking around the ball park of 30 s not withstanding wether it's the first or a subsequent run:

with

Without it, it's way less:

without

@jogold
Copy link
Contributor

jogold commented Jul 20, 2020

@th3r10n are you on macOS?

@th3r10n
Copy link
Author

th3r10n commented Jul 20, 2020

Yes @jogold. I'm on macOS.

@jogold
Copy link
Contributor

jogold commented Jul 20, 2020

OK, this is a duplicate of #9120

@eladb
Copy link
Contributor

eladb commented Jul 26, 2020

Dup #9120

@eladb eladb closed this as completed Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants