-
Notifications
You must be signed in to change notification settings - Fork 820
Description
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
20.19.2
Amplify CLI Version
13.0.1
What operating system are you using?
Windows
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes were made. This issue is reproducible after a fresh installation of Amplify CLI v13.0.1 and running amplify codegen models
.
Describe the bug
When running amplify codegen models
, the generated file at src/models/index.js
contains a ReferenceError
.
The generator creates JavaScript constants for GraphQL enums with PascalCasing (e.g., const RtcRecordType = { ... }
), but the export
statement at the end of the file tries to export them using a different, uppercase casing (e.g., export { RTCRecordType }
). This causes the application build to fail because the exported identifier does not exist.
This issue started occurring immediately after upgrading from @aws-amplify/cli@13.0.0
to @aws-amplify/cli@13.0.1
. Downgrading back to 13.0.0
and regenerating models resolves the issue, confirming it's a regression in the latest version.
Expected behavior
The export
statement in src/models/index.js
should use the same variable names that are defined within that file, so that no ReferenceError
occurs and the application can build successfully.
For example, if the generator creates const RtcRecordType
, it should also export RtcRecordType
, not RTCRecordType
.
Reproduction steps
- Use
@aws-amplify/cli
version13.0.1
. - Define a GraphQL schema (
schema.graphql
) that contains an enum with an uppercase acronym, likeRTC
. - Run the
amplify codegen models
command. - Try to build the Vue application (e.g., using
pnpm run dev
with Vite). - The build will fail with a
ReferenceError
originating fromsrc/models/index.js
.
Project Identifier
No response
Log output
# Put your logs below this line
Error: Failed to scan for dependencies from entries:
C:/my-path/index.html
X [ERROR] "RTCRecordDetailType" is not declared in this file
src/models/index.js:221:2:
221 │ RTCRecordDetailType,
╵ ~~~~~~~~~~~~~~~~~~~
X [ERROR] "RTCRecordDetailDataType" is not declared in this file
src/models/index.js:222:2:
222 │ RTCRecordDetailDataType,
╵ ~~~~~~~~~~~~~~~~~~~~~~~
X [ERROR] "RTCRecordType" is not declared in this file
src/models/index.js:223:2:
223 │ RTCRecordType,
Additional information
No response
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.