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

(cdk synth): (Unexpected token '?' Subprocess exited with error 1) #20852

Closed
ashishchandr70 opened this issue Jun 23, 2022 · 3 comments
Closed
Assignees
Labels
bug This issue is a bug. package/tools Related to AWS CDK Tools or CLI

Comments

@ashishchandr70
Copy link

Describe the bug

Getting this error in our Code Pipeline build process: Unexpected token '?' Subprocess exited with error 1. The issue appears to be related to #20681 but I fail to see from that issue how it can be resolved without needing to upgrade Node.js to a higher version.

This had been working up until a few days ago.

Expected Behavior

The build process should have succeeded.

Current Behavior

Build stage fails.

Reproduction Steps

npx cdk synth --verbose produces the following output:

[Container] 2022/06/23 22:54:40 Waiting for agent ping
--
2 | [Container] 2022/06/23 22:54:41 Waiting for DOWNLOAD_SOURCE
3 | [Container] 2022/06/23 22:54:46 Phase is DOWNLOAD_SOURCE
4 | [Container] 2022/06/23 22:54:46 CODEBUILD_SRC_DIR=/codebuild/output/src468114619/src
5 | [Container] 2022/06/23 22:54:46 YAML location is /codebuild/readonly/buildspec.yml
6 | [Container] 2022/06/23 22:54:46 Processing environment variables
7 | [Container] 2022/06/23 22:54:46 No runtime version selected in buildspec.
8 | [Container] 2022/06/23 22:54:48 Moving to directory /codebuild/output/src468114619/src
9 | [Container] 2022/06/23 22:54:48 Configuring ssm agent with target id: codebuild:c75ddf28-ee8a-4460-819d-2d0c2a1a497b
10 | [Container] 2022/06/23 22:54:48 Successfully updated ssm agent configuration
11 | [Container] 2022/06/23 22:54:48 Registering with agent
12 | [Container] 2022/06/23 22:54:48 Phases found in YAML: 2
13 | [Container] 2022/06/23 22:54:48  PRE_BUILD: 1 commands
14 | [Container] 2022/06/23 22:54:48  BUILD: 2 commands
15 | [Container] 2022/06/23 22:54:48 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
16 | [Container] 2022/06/23 22:54:48 Phase context status code:  Message:
17 | [Container] 2022/06/23 22:54:48 Entering phase INSTALL
18 | [Container] 2022/06/23 22:54:48 Phase complete: INSTALL State: SUCCEEDED
19 | [Container] 2022/06/23 22:54:48 Phase context status code:  Message:
20 | [Container] 2022/06/23 22:54:48 Entering phase PRE_BUILD
21 | [Container] 2022/06/23 22:54:48 Running command npm run bootstrap
22 |  
23 | > krono-stacks@1.0.0 bootstrap /codebuild/output/src468114619/src
24 | > npm run build:lib && npm install && lerna bootstrap
25 |  
26 |  
27 | > krono-stacks@1.0.0 build:lib /codebuild/output/src468114619/src
28 | > ./copy-lib-files.sh
29 |  
30 | Thu Jun 23 22:54:59 UTC 2022 Created all links in docker/blockchain/lib
31 | Thu Jun 23 22:54:59 UTC 2022 Created all links in docker/indexer/lib
32 | Thu Jun 23 22:54:59 UTC 2022 Created all links in docker/cryptofights/lib
33 | Thu Jun 23 22:54:59 UTC 2022 Created all links in docker/validator/lib
34 | Copying bots.ts to docker/matchmaker
35 | Thu Jun 23 22:54:59 UTC 2022 All tasks completed successfully
36 |  
37 | > es5-ext@0.10.61 postinstall /codebuild/output/src468114619/src/node_modules/es5-ext
38 | >  node -e "try{require('./_postinstall')}catch(e){}" \|\| exit 0
39 |  
40 |  
41 | > protobufjs@6.11.3 postinstall /codebuild/output/src468114619/src/node_modules/protobufjs
42 | > node scripts/postinstall
43 |  
44 | npm WARN The package typescript is included as both a dev and production dependency.
45 | npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
46 | npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
47 |  
48 | added 1781 packages from 732 contributors and audited 1796 packages in 29.167s
49 |  
50 | 107 packages are looking for funding
51 | run `npm fund` for details
52 |  
53 | found 22 vulnerabilities (1 moderate, 21 high)
54 | run `npm audit fix` to fix them, or `npm audit` for details
55 | lerna notice cli v3.22.1
56 | lerna info ci enabled
57 | lerna info Bootstrapping 15 packages
58 | lerna info Installing external dependencies
59 | lerna info Symlinking packages and binaries
60 | lerna success Bootstrapped 15 packages
61 |  
62 | [Container] 2022/06/23 22:56:18 Phase complete: PRE_BUILD State: SUCCEEDED
63 | [Container] 2022/06/23 22:56:18 Phase context status code:  Message:
64 | [Container] 2022/06/23 22:56:18 Entering phase BUILD
65 | [Container] 2022/06/23 22:56:18 Running command npx cross-env NODE_ENV=dev npm run build
66 |  
67 | > krono-stacks@1.0.0 build /codebuild/output/src468114619/src
68 | > npm run build:cdk && lerna run build --stream
69 |  
70 |  
71 | > krono-stacks@1.0.0 build:cdk /codebuild/output/src468114619/src
72 | > tsc --build tsconfig.root.json
73 |  
74 | lerna notice cli v3.22.1
75 | lerna info ci enabled
76 | lerna info Executing command in 13 packages: "npm run build"
77 | krono-blockchain: > krono-blockchain@1.0.0 build /codebuild/output/src468114619/src/docker/blockchain
78 | krono-blockchain: > tsc -p .
79 | cryptofights: > cryptofights@1.0.0 build /codebuild/output/src468114619/src/docker/cryptofights
80 | cryptofights: > tsc -p .
81 | fyx-indexer: > fyx-indexer@1.0.0 build /codebuild/output/src468114619/src/docker/indexer
82 | fyx-indexer: > tsc -p .
83 | cf-matchmaker: > cf-matchmaker@1.0.0 build /codebuild/output/src468114619/src/docker/matchmaker
84 | cf-matchmaker: > tsc -p .
85 | fyx-pay-server: > fyx-pay-server@1.0.0 build /codebuild/output/src468114619/src/docker/pay
86 | fyx-pay-server: > tsc -p .
87 | pg-mock: > pg-mock@0.0.0 build /codebuild/output/src468114619/src/docker/pg-mock
88 | pg-mock: > tsc
89 | cryptofights-validator: > cryptofights-validator@0.0.0 build /codebuild/output/src468114619/src/docker/validator
90 | cryptofights-validator: > tsc -p .
91 | create-indexes: > create-indexes@0.0.0 build /codebuild/output/src468114619/src/functions/create-indexes
92 | create-indexes: > tsc
93 | create-indexes: > create-indexes@0.0.0 postbuild /codebuild/output/src468114619/src/functions/create-indexes
94 | create-indexes: > cp package.json dist/package.json && cd dist && npm install --only=production
95 | create-indexes: npm notice created a lockfile as package-lock.json. You should commit this file.
96 | create-indexes: added 17 packages from 13 contributors and audited 18 packages in 2.116s
97 | create-indexes: 1 package is looking for funding
98 | create-indexes:   run `npm fund` for details
99 | create-indexes: found 0 vulnerabilities
100 | exchange-rate: > exchange-rate@0.0.0 build /codebuild/output/src468114619/src/functions/exchange-rate
101 | exchange-rate: > tsc
102 | notify-slack-put: > notify-slack-put@0.0.0 build /codebuild/output/src468114619/src/functions/notify-slack-put
103 | notify-slack-put: > tsc
104 | notify-slack-put: > notify-slack-put@0.0.0 postbuild /codebuild/output/src468114619/src/functions/notify-slack-put
105 | notify-slack-put: > cp package.json dist/package.json && cp package-lock.json dist/package-lock.json && cd dist && npm install --only=production
106 | notify-slack-put: added 4 packages from 4 contributors and audited 4 packages in 0.256s
107 | notify-slack-put: found 0 vulnerabilities
108 | purse-alert: > purse-alert@0.0.0 build /codebuild/output/src468114619/src/functions/purse-alert
109 | purse-alert: > tsc
110 | exchange-rate: > exchange-rate@0.0.0 postbuild /codebuild/output/src468114619/src/functions/exchange-rate
111 | exchange-rate: > cp package.json dist/package.json && cd dist && npm install --only=production
112 | exchange-rate: npm notice created a lockfile as package-lock.json. You should commit this file.
113 | exchange-rate: added 17 packages from 13 contributors and audited 17 packages in 0.682s
114 | exchange-rate: 1 package is looking for funding
115 | exchange-rate:   run `npm fund` for details
116 | exchange-rate: found 0 vulnerabilities
117 | purse-monitor: > purse-monitor@0.0.0 build /codebuild/output/src468114619/src/functions/purse-monitor
118 | purse-monitor: > tsc
119 | purse-alert: > purse-alert@0.0.0 postbuild /codebuild/output/src468114619/src/functions/purse-alert
120 | purse-alert: > cp package.json dist/package.json && cp package-lock.json dist/package-lock.json && cd dist && npm install --only=production
121 | purse-alert: added 41 packages from 47 contributors and audited 41 packages in 1.297s
122 | purse-alert: 4 packages are looking for funding
123 | purse-alert:   run `npm fund` for details
124 | purse-alert: found 0 vulnerabilities
125 | user-email-verification: > user-email-verification@0.0.0 build /codebuild/output/src468114619/src/functions/user-email-verification
126 | user-email-verification: > tsc
127 | purse-monitor: > purse-monitor@0.0.0 postbuild /codebuild/output/src468114619/src/functions/purse-monitor
128 | purse-monitor: > cp package.json dist/package.json && cp package-lock.json dist/package-lock.json && cd dist && npm install --only=production
129 | purse-monitor: added 39 packages from 47 contributors and audited 40 packages in 1.319s
130 | purse-monitor: 5 packages are looking for funding
131 | purse-monitor:   run `npm fund` for details
132 | purse-monitor: found 0 vulnerabilities
133 | user-email-verification: > user-email-verification@0.0.0 postbuild /codebuild/output/src468114619/src/functions/user-email-verification
134 | user-email-verification: > cp package.json dist/package.json && cp package-lock.json dist/package-lock.json && cd dist && npm install --only=production
135 | user-email-verification: added 110 packages from 128 contributors and audited 116 packages in 1.615s
136 | user-email-verification: 6 packages are looking for funding
137 | user-email-verification:   run `npm fund` for details
138 | user-email-verification: found 0 vulnerabilities
139 | lerna success run Ran npm script 'build' in 13 packages in 89.5s:
140 | lerna success - krono-blockchain
141 | lerna success - cryptofights
142 | lerna success - fyx-indexer
143 | lerna success - cf-matchmaker
144 | lerna success - fyx-pay-server
145 | lerna success - pg-mock
146 | lerna success - cryptofights-validator
147 | lerna success - create-indexes
148 | lerna success - exchange-rate
149 | lerna success - notify-slack-put
150 | lerna success - purse-alert
151 | lerna success - purse-monitor
152 | lerna success - user-email-verification
153 |  
154 | [Container] 2022/06/23 22:58:01 Running command npx cdk synth --verbose
155 | CDK toolkit version: 1.100.0 (build d996c6d)
156 | Command line arguments: {
157 | _: [ 'synth' ],
158 | verbose: 1,
159 | v: 1,
160 | lookups: true,
161 | 'ignore-errors': false,
162 | ignoreErrors: false,
163 | json: false,
164 | j: false,
165 | debug: false,
166 | ec2creds: undefined,
167 | i: undefined,
168 | 'version-reporting': undefined,
169 | versionReporting: undefined,
170 | 'path-metadata': true,
171 | pathMetadata: true,
172 | 'asset-metadata': true,
173 | assetMetadata: true,
174 | 'role-arn': undefined,
175 | r: undefined,
176 | roleArn: undefined,
177 | staging: true,
178 | 'no-color': false,
179 | noColor: false,
180 | fail: false,
181 | quiet: false,
182 | q: false,
183 | '$0': 'node_modules/.bin/cdk'
184 | }
185 | cdk.json: {
186 | "app": "npx ts-node aws/bin/aws.ts",
187 | "context": {
188 | "@aws-cdk/core:newStyleStackSynthesis": true,
189 | "@aws-cdk/core:enableStackNameDuplicates": "true",
190 | "aws-cdk:enableDiffNoFail": "true",
191 | "@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": true
192 | }
193 | }
194 | cdk.context.json: {
195 | "availability-zones:account=231626651498:region=us-east-1": [
196 | "us-east-1a",
197 | "us-east-1b",
198 | "us-east-1c",
199 | "us-east-1d",
200 | "us-east-1e",
201 | "us-east-1f"
202 | ],
203 | "availability-zones:account=231626651498:region=us-east-2": [
204 | "us-east-2a",
205 | "us-east-2b",
206 | "us-east-2c"
207 | ]
208 | }
209 | merged settings: {
210 | versionReporting: true,
211 | pathMetadata: true,
212 | output: 'cdk.out',
213 | app: 'npx ts-node aws/bin/aws.ts',
214 | context: {
215 | '@aws-cdk/core:newStyleStackSynthesis': true,
216 | '@aws-cdk/core:enableStackNameDuplicates': 'true',
217 | 'aws-cdk:enableDiffNoFail': 'true',
218 | '@aws-cdk/aws-ecr-assets:dockerIgnoreSupport': true
219 | },
220 | debug: false,
221 | assetMetadata: true,
222 | toolkitBucket: {},
223 | staging: true,
224 | bundlingStacks: [ '*' ],
225 | lookups: true
226 | }
227 | Toolkit stack: CDKToolkit
228 | Setting "CDK_DEFAULT_REGION" environment variable to us-east-1
229 | Resolving default credentials
230 | Looking up default account ID from STS
231 | Default account ID: 231626651498
232 | Setting "CDK_DEFAULT_ACCOUNT" environment variable to 231626651498
233 | context: {
234 | 'availability-zones:account=231626651498:region=us-east-1': [
235 | 'us-east-1a',
236 | 'us-east-1b',
237 | 'us-east-1c',
238 | 'us-east-1d',
239 | 'us-east-1e',
240 | 'us-east-1f'
241 | ],
242 | 'availability-zones:account=231626651498:region=us-east-2': [ 'us-east-2a', 'us-east-2b', 'us-east-2c' ],
243 | '@aws-cdk/core:newStyleStackSynthesis': true,
244 | '@aws-cdk/core:enableStackNameDuplicates': 'true',
245 | 'aws-cdk:enableDiffNoFail': 'true',
246 | '@aws-cdk/aws-ecr-assets:dockerIgnoreSupport': true,
247 | 'aws:cdk:enable-path-metadata': true,
248 | 'aws:cdk:enable-asset-metadata': true,
249 | 'aws:cdk:version-reporting': true,
250 | 'aws:cdk:bundling-stacks': [ '*' ]
251 | }
252 | outdir: cdk.out
253 | env: {
254 | CDK_DEFAULT_REGION: 'us-east-1',
255 | CDK_DEFAULT_ACCOUNT: '231626651498',
256 | CDK_CONTEXT_JSON: '{"availability-zones:account=231626651498:region=us-east-1":["us-east-1a","us-east-1b","us-east-1c","us-east-1d","us-east-1e","us-east-1f"],"availability-zones:account=231626651498:region=us-east-2":["us-east-2a","us-east-2b","us-east-2c"],"@aws-cdk/core:newStyleStackSynthesis":true,"@aws-cdk/core:enableStackNameDuplicates":"true","aws-cdk:enableDiffNoFail":"true","@aws-cdk/aws-ecr-assets:dockerIgnoreSupport":true,"aws:cdk:enable-path-metadata":true,"aws:cdk:enable-asset-metadata":true,"aws:cdk:version-reporting":true,"aws:cdk:bundling-stacks":["*"]}',
257 | CDK_OUTDIR: 'cdk.out',
258 | CDK_CLI_ASM_VERSION: '9.0.0',
259 | CDK_CLI_VERSION: '1.100.0'
260 | }
261 | Unexpected token '?'
262 | Subprocess exited with error 1
263 | Error: Subprocess exited with error 1
264 | at ChildProcess.<anonymous> (/codebuild/output/src468114619/src/node_modules/aws-cdk/lib/api/cxapp/exec.ts:122:23)
265 | at ChildProcess.emit (events.js:314:20)
266 | at ChildProcess.EventEmitter.emit (domain.js:483:12)
267 | at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
268 |  
269 | [Container] 2022/06/23 22:58:07 Command did not exit successfully npx cdk synth --verbose exit status 1
270 | [Container] 2022/06/23 22:58:07 Phase complete: BUILD State: FAILED
271 | [Container] 2022/06/23 22:58:07 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npx cdk synth --verbose. Reason: exit status 1
272 | [Container] 2022/06/23 22:58:07 Entering phase POST_BUILD
273 | [Container] 2022/06/23 22:58:07 Phase complete: POST_BUILD State: SUCCEEDED
274 | [Container] 2022/06/23 22:58:07 Phase context status code:  Message:
275 | [Container] 2022/06/23 22:58:07 Expanding base directory path: cdk.out
276 | [Container] 2022/06/23 22:58:07 Assembling file list
277 | [Container] 2022/06/23 22:58:07 Expanding cdk.out
278 | [Container] 2022/06/23 22:58:07 Expanding file paths for base directory cdk.out
279 | [Container] 2022/06/23 22:58:07 Assembling file list
280 | [Container] 2022/06/23 22:58:07 Expanding **/*
281 | [Container] 2022/06/23 22:58:07 Phase complete: UPLOAD_ARTIFACTS State: FAILED
282 | [Container] 2022/06/23 22:58:07 Phase context status code: CLIENT_ERROR Message: no matching artifact paths found

Possible Solution

No response

Additional Information/Context

CDK_DEFAULT_REGION: 'us-east-1',
CDK_DEFAULT_ACCOUNT: '231626651498',
CDK_CONTEXT_JSON: '{"availability-zones:account=231626651498:region=us-east-1":["us-east-1a","us-east-1b","us-east-1c","us-east-1d","us-east-1e","us-east-1f"],"availability-zones:account=231626651498:region=us-east-2":["us-east-2a","us-east-2b","us-east-2c"],"@aws-cdk/core:newStyleStackSynthesis":true,"@aws-cdk/core:enableStackNameDuplicates":"true","aws-cdk:enableDiffNoFail":"true","@aws-cdk/aws-ecr-assets:dockerIgnoreSupport":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: '9.0.0',

CDK CLI Version

1.100.0

Framework Version

No response

Node.js Version

14.18.21

OS

CodePipeline

Language

Typescript

Language Version

4.0.3

Other information

No response

@ashishchandr70 ashishchandr70 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 23, 2022
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Jun 23, 2022
@ashishchandr70
Copy link
Author

Upgrading our environment to Node 14 should have fixed this as per the articles I have read in this forum. However, now the error has gotten even more cryptic.

A bunch of warnings and then a failure:



[WARNING] @aws-cdk/pipelines.CdkPipeline#validate is deprecated.
--
969 | This class is part of the old API. Use the API based on the `CodePipeline` class instead
970 | This API will be removed in the next major release.
971 | [WARNING] @aws-cdk/pipelines.CdkPipeline#validate is deprecated.
972 | This class is part of the old API. Use the API based on the `CodePipeline` class instead
973 | This API will be removed in the next major release.
974 | [WARNING] @aws-cdk/pipelines.CdkPipeline#validate is deprecated.
975 | This class is part of the old API. Use the API based on the `CodePipeline` class instead
976 | This API will be removed in the next major release.
977 | Reading cached notices from /root/.cdk/cache/notices.json
978 |  
979 | Subprocess exited with error 1
980 | Error: Subprocess exited with error 1
981 | at ChildProcess.<anonymous> (/codebuild/output/src492733092/src/node_modules/aws-cdk/lib/api/cxapp/exec.ts:131:23)
982 | at ChildProcess.emit (events.js:400:28)
983 | at ChildProcess.emit (domain.js:475:12)
984 | at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
985 |  
986 | [Container] 2022/06/28 16:52:45 Command did not exit successfully npx cdk synth --verbose exit status 1
987 | [Container] 2022/06/28 16:52:45 Phase complete: BUILD State: FAILED
988 | [Container] 2022/06/28 16:52:45 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npx cdk synth --verbose. Reason: exit status 1

Any updates at all?

@peterwoodworth
Copy link
Contributor

Please see this thread for more information and concerns, there's some good discussion here #20739

@peterwoodworth peterwoodworth closed this as not planned Won't fix, can't repro, duplicate, stale Jul 1, 2022
@peterwoodworth peterwoodworth removed the needs-triage This issue or PR still needs to be triaged. label Jul 1, 2022
@github-actions
Copy link

github-actions bot commented Jul 1, 2022

⚠️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
bug This issue is a bug. package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

3 participants