Commit 06de3f3
committed
fix(amplify-graphql-api-construct-tests): pin cdk init CLI and type e2e lambda scaffolds
Fixes the deterministic custom_query_mutation_extension and admin_role e2e failures.
The e2e scratch-project scaffolder pinned aws-cdk-lib but ran `npx cdk init` with a
floating CLI. The upstream template has since changed the cdk.json synth command from
`npx ts-node --prefer-ts-exts bin/app.ts` to `npx tsc && npx tsx bin/app.ts` on
TypeScript ~7.0 with strict/noImplicitAny and no tsconfig include, so synth now begins
with a whole-project typecheck of every .ts in the scratch project.
Backend templates are copied wholesale into bin/, including lambda entry points that are
only ever referenced by esbuild as a path string and never imported by app.ts. Those files
are now typechecked from a directory they were never written to resolve from, failing
before synth:
- custom-query-mutation-extension/authorizer.ts:1:26 TS7006 (untyped event)
- admin-role/apiInvoker.ts:6:51 TS2307 ('../../../lambda-request' escapes the project)
- Pin the aws-cdk CLI so the template cannot drift again. The CLI and aws-cdk-lib have
used separate version lines since CLI v2.1000.0, so the CLI is pinned to its own
constant rather than to cdkVersion (no aws-cdk release matches aws-cdk-lib 2.260.0,
and cdkVersion may legitimately be 'latest').
- Drop the whole-project typecheck from the generated synth command, restoring the
historical behavior where synth only loads the app's import graph. The runtime
invocation is unchanged.
- Type the authorizer handler event, and inline the response type in apiInvoker.ts so the
bundled lambda entry is self-contained. All previously exported names remain exported.1 parent 2f81117 commit 06de3f3
3 files changed
Lines changed: 58 additions & 3 deletions
File tree
- packages/amplify-graphql-api-construct-tests/src
- __tests__/backends
- admin-role
- custom-query-mutation-extension
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
7 | 24 | | |
8 | 25 | | |
9 | 26 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
4 | 8 | | |
| |||
Lines changed: 35 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
68 | 100 | | |
69 | 101 | | |
70 | 102 | | |
| |||
82 | 114 | | |
83 | 115 | | |
84 | 116 | | |
85 | | - | |
| 117 | + | |
86 | 118 | | |
87 | 119 | | |
88 | 120 | | |
| |||
93 | 125 | | |
94 | 126 | | |
95 | 127 | | |
| 128 | + | |
| 129 | + | |
96 | 130 | | |
97 | 131 | | |
98 | 132 | | |
| |||
0 commit comments