Error exporting metadata
bernatvadell opened this issue · comments
Hi!
Im trying to configure hasura console to manage migrations.
I've tested the binary for linux and the npm package, but the error is the same.
npx hasura-cli metadata export
FATA[0000] failed to export metadata: cannot export actions from metadata: error parsing metadata
object: actions
file: actions.yaml
error: error in converting metadata to sdl: exit status 1: internal/modules/package_json_reader.js:4
const internalModuleReadJSON = function (f) { return require('fs').internalModuleReadJSON(f); };
^
TypeError: require(...).internalModuleReadJSON is not a function
at internalModuleReadJSON (internal/modules/package_json_reader.js:4:68)
at Object.read (internal/modules/package_json_reader.js:19:34)
at readPackage (internal/modules/cjs/loader.js:237:36)
at readPackageScope (internal/modules/cjs/loader.js:270:19)
at trySelf (internal/modules/cjs/loader.js:386:40)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:24)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at Module._preloadModules (internal/modules/cjs/loader.js:1147:12)
at loadPreloadModules (internal/bootstrap/pre_execution.js:451:5)
Enviroment
- SO: Ubuntu 20.04 over WSL in Windows 11
- Node: 14.16.1 (tested on 12 & 16)
- Npm: 7.17.0
@bernatvadell
I get this exact same error, but only if I run it in VSCode. If I use WindowsTerminal to open my Ubuntu shell and run it from there, it works.
@bernatvadell @jrobber Hi!
Thank you for reporting the issue!
May I ask if this happens with the latest version? (I personally don't use/have a Windows machine (though I may be able to use VM if necessary), so I'd like you to test if possible)
Thanks!
I am also curious whether npx hasura-cli metadata export
and npx hasura metadata export
can have different results.
I 'guess', theoretically, some of these scenarios may be possible. (I don't know if CLI can be executed both on WSL and Windows regardless of how it was installed.)
@bernatvadell @jrobber
Would you advise which are possible and which you can test?
Thanks!
-
'1'. Install package manager(e.g. npm) on Windows (not WSL),
- 1.1. and execute
npm install
on Windows shell (command prompt of CMD or Powershell),- 1.1.1. and execute
npx hasura-cli metadata export
- 1.1.1.1. on WSL
- 1.1.1.2. on Windows
- 1.1.2. and execute
npx hasura metadata export
- 1.1.2.1. on WSL
- 1.1.2.2. on Windows
- 1.1.1. and execute
- 1.2. and execute
npm install
on WSL- 1.2.1. and execute
npx hasura-cli metadata export
- 1.2.1.1. on WSL
- 1.2.1.2. on Windows
- 1.2.2. and execute
npx hasura metadata export
- 1.2.2.1. on WSL
- 1.2.2.2. on Windows
- 1.2.1. and execute
- 1.1. and execute
-
'2'. Install package manager(e.g. npm) on WSL(not Windows),
- 2.1. and execute
npm install
on Windows shell (command prompt of CMD or Powershell),- 2.1.1. and execute
npx hasura-cli metadata export
- 2.1.1.1. on WSL
- 2.1.1.2. on Windows
- 2.1.2. and execute
npx hasura metadata export
- 2.1.2.1. on WSL
- 2.1.2.2. on Windows
- 2.1.1. and execute
- 2.2. and execute
npm install
on WSL- 2.2.1. and execute
npx hasura-cli metadata export
- 2.2.1.1. on WSL
- 2.2.1.2. on Windows
- 2.2.2. and execute
npx hasura metadata export
- 2.2.2.1. on WSL
- 2.2.2.2. on Windows
- 2.2.1. and execute
- 2.1. and execute
I get this exact same error, but only if I run it in VSCode. If I use WindowsTerminal to open my Ubuntu shell and run it from there, it works.
Maybe, that's because VSCode changes the environment, like by adding NODE_OPTIONS
or so. Let me know if you know/find some information!
I had the same issue with applying metadata to the GraphQL engine when running from VSCode's integrated terminal. When run from the standard macOS terminal it worked fine. I was running Hasura commands from VSCode without any issues just until recently so maybe it's connected to the VSCode version (it automatically installs updates on my machine)?
VSCode version: 1.73.1
Hasura CLI version: 2.6.1