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

Cannot find module 'amplify-codegen/src/codegen-config' #1

Open
jcbdev opened this issue Dec 9, 2020 · 3 comments
Open

Cannot find module 'amplify-codegen/src/codegen-config' #1

jcbdev opened this issue Dec 9, 2020 · 3 comments

Comments

@jcbdev
Copy link

jcbdev commented Dec 9, 2020

First of all - Nice work! I've been looking for this exact type of thing for ages!

Unfortunately for me I get the following error when running the generate command:

Cannot find module 'amplify-codegen/src/codegen-config'
Require stack:
- /usr/local/lib/node_modules/amplify-graphql-fragments-generator/lib/commands/generate.js
- /usr/local/lib/node_modules/amplify-graphql-fragments-generator/lib/index.js
- /usr/local/lib/node_modules/@aws-amplify/cli/lib/execution-manager.js
- /usr/local/lib/node_modules/@aws-amplify/cli/lib/index.js
- /usr/local/lib/node_modules/@aws-amplify/cli/bin/amplify
/usr/local/lib/node_modules/amplify-graphql-fragments-generator/lib/commands/generate.js:1
Error: Cannot find module 'amplify-codegen/src/codegen-config'
Require stack:
- /usr/local/lib/node_modules/amplify-graphql-fragments-generator/lib/commands/generate.js
- /usr/local/lib/node_modules/amplify-graphql-fragments-generator/lib/index.js
- /usr/local/lib/node_modules/@aws-amplify/cli/lib/execution-manager.js
- /usr/local/lib/node_modules/@aws-amplify/cli/lib/index.js
- /usr/local/lib/node_modules/@aws-amplify/cli/bin/amplify
    at Object.<anonymous> (/usr/local/lib/node_modules/amplify-graphql-fragments-generator/lib/commands/generate.js:27:42)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)

This probably means you need to 'amplify-codegen' as a dependency in the package.json

Unfortunately even after installing globally npm install -g amplify-codegen I get the following call stack issue:

Generated fragments and statements successfully and saved at /Users/jimbo/Projects/roar/packages/core/graphql
(node:3627) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
    at getType (/usr/local/lib/node_modules/amplify-graphql-fragments-generator/node_modules/amplify-graphql-docs-generator/lib/generator/utils/getType.js:4:17)
    at Object.getType [as default] (/usr/local/lib/node_modules/amplify-graphql-fragments-generator/node_modules/amplify-graphql-docs-generator/lib/generator/utils/getType.js:6:16)
    at Object.getFields (/usr/local/lib/node_modules/amplify-graphql-fragments-generator/lib/generator/getFields.js:16:40)
    at /usr/local/lib/node_modules/amplify-graphql-fragments-generator/lib/generator/getFragment.js:16:37
    at Array.map (<anonymous>)
    at Object.getFragment (/usr/local/lib/node_modules/amplify-graphql-fragments-generator/lib/generator/getFragment.js:16:10)
    at Object.getFields (/usr/local/lib/node_modules/amplify-graphql-fragments-generator/lib/generator/getFields.js:43:40)
    at /usr/local/lib/node_modules/amplify-graphql-fragments-generator/lib/generator/getFragment.js:16:37
    at Array.map (<anonymous>)
    at Object.getFragment (/usr/local/lib/node_modules/amplify-graphql-fragments-generator/lib/generator/getFragment.js:16:10)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3627) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3627) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Maybe my schema has a self-referencing model or two models which reference each other and its getting caught in a recursive loop?

artemkloko added a commit that referenced this issue Dec 10, 2020
artemkloko added a commit that referenced this issue Dec 10, 2020
@artemkloko
Copy link
Owner

artemkloko commented Dec 10, 2020

Thank you! @jcbdev could you please try the 1-cannot-find-codegen-and-maxDepth-bug-build branch? You can do so by running the following

yarn global add amplify-graphql-fragments-generator@https://github.com/artemkloko/amplify-graphql-fragments-generator.git\#1-cannot-find-codegen-and-maxDepth-bug-build
amplify codegen-with-fragments generate

@jcbdev
Copy link
Author

jcbdev commented Dec 16, 2020

@artemkloko Awesome thanks! I will try it out in the next few weeks but I am super busy at the moment!

@dmdmd
Copy link

dmdmd commented Jul 18, 2021

@artemkloko I got the same error. Running your commands didn't work. Is there a way to double-check if I the correct version of the plugin was installed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants