amplify codegen add gives error: 'The "path" argument must be of type string'
See original GitHub issueDescribe the bug Error when adding an existing API to codegen.
amplify codegen add --apiId XXXMyApiIdXXXX
adds “api” section to amplify-meta.json files but then terminates with error:
$ amplify codegen add --apiId XXXXXXX
✔ Getting API details
✖ Getting API details
The "path" argument must be of type string. Received type undefined
Trying to get it up and running using statements command i got a callstack:
/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/gluegun/build/index.js:13
throw up;
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at assertPath (path.js:39:11)
at Object.join (path.js:1155:7)
at projects.forEach (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-codegen/src/commands/statements.js:19:31)
at Array.forEach (<anonymous>)
at Object.generateStatements (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-codegen/src/commands/statements.js:18:12)
at Command.run (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-codegen/commands/codegen/statements.js:11:21)
at Runtime.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/gluegun/build/runtime/run.js:90:58)
at step (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/gluegun/build/runtime/run.js:32:23)
at Object.next (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/gluegun/build/runtime/run.js:13:53)
at /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/gluegun/build/runtime/run.js:7:71
To Reproduce Steps to reproduce the behavior:
- A project with no API managed by CFN
- type $ amplify codegen add --apiId XXXXXX to add an API that has been created with AppSync console before.
Expected behavior The command should successfully add the external API.
Desktop (please complete the following information):
- OS: macOS
- Amplify CLI 1.1.7
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
API (GraphQL) - Client code generation - AWS Amplify Docs
Codegen helps you generate native code for iOS and Android, as well as the generation of types for Flow and TypeScript. It can...
Read more >The "path" argument must be of type string or an instance of ...
Apparently, config.outputFolder is undefined at that point. You could confirm this by logging its value before running fs.mkDirSync . Share.
Read more >TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them.
Read more >GraphQL error handling to the max with Typescript, codegen ...
We'll see in this article how to: achieve a better error representation than the default offered by GraphQL; get type safety using Typescript ......
Read more >GraphQL Code Libraries, Tools and Services
Add any type specific cache control directives in the format: ... GitHubaws-amplify/amplify-js ... Tiny GraphQL client library using template strings.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just had similar problem. Solved it by adding
projectPath
attribute in<project_root>/amplify/.config/local-env-info.json
with a valid path, worked both absolute and relative paths for me.This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels for those types of questions.