You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When setting up the postgraphile handler using file paths like the below example. It does not translate the file paths when building the production output, and throws errors that modules are not found.
This is supposed to load 2 modules, my ./postgraphileOptions.json file and my ./plugins/renameSubscriptionsPlugin file.
Both of these load without any issues when running mesh dev, and the schema also builds fine when running mesh build.
But when running mesh start after running mesh build I get the following error:
(node:31309) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
🕸️ - Server: Generating the unified schema...
🕸️ - crm: Failed to generate the schema
Error: Cannot find module './plugins/renameSubscriptionsPlugin'.
at importFn (/Users/marklyck/colony/graphql-mesh/.mesh/index.ts:44180:11)
at tryImport (/Users/marklyck/colony/graphql-mesh/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-mesh/utils/index.js:72:12)
at Object.loadFromModuleExportExpression (/Users/marklyck/colony/graphql-mesh/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-mesh/utils/index.js:69:12)
at /Users/marklyck/colony/graphql-mesh/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-mesh/postgraphile/index.js:68:107
at Array.map (<anonymous>)
at PostGraphileHandler.getMeshSource (/Users/marklyck/colony/graphql-mesh/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-mesh/postgraphile/index.js:68:83)
at async /Users/marklyck/colony/graphql-mesh/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-mesh/runtime/index.js:39:28
🕸️ - Server: Error: Schemas couldn't be generated successfully. Check for the logs by running Mesh with DEBUG=1 environmental variable to get more verbose output.
at Object.getMesh (/Users/marklyck/colony/graphql-mesh/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-mesh/runtime/index.js:69:15)
ELIFECYCLE Command failed with exit code 1.
If I remove my custom plugin temporarily the error changes too:
🕸️ - crm: Failed to generate the schema
Error: Cannot find module './postGraphileOptions.json'.
at importFn (/Users/marklyck/colony/graphql-mesh/.mesh/index.ts:53420:11)
at tryImport (/Users/marklyck/colony/graphql-mesh/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-mesh/utils/index.js:72:12)
at Object.loadFromModuleExportExpression (/Users/marklyck/colony/graphql-mesh/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-mesh/utils/index.js:69:12)
at PostGraphileHandler.getMeshSource (/Users/marklyck/colony/graphql-mesh/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-mesh/postgraphile/index.js:78:37)
at async /Users/marklyck/colony/graphql-mesh/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-mesh/runtime/index.js:39:28
🕸️ - Server: Error: Schemas couldn't be generated successfully. Check for the logs by running Mesh with DEBUG=1 environmental variable to get more verbose output.
at Object.getMesh (/Users/marklyck/colony/graphql-mesh/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-mesh/runtime/index.js:69:15)
ELIFECYCLE Command failed with exit code 1.
This shows that any file paths set in the postgraphile handler does not seem to work when building for production.
Note: using local file paths works just fine when running mesh dev. It's only when running it in production it fails.
To Reproduce
Add any file path to a postgraphile handler and try to build and start for production.
Expected behavior
The file path should be translated correctly.
I tried to manually go edit the ouputted index.ts file to fix this, and got it working.
since the index.ts imports these as external modules and gives them a set name, I manually tried editing the these 2 lines and got it working:
MarkLyck
changed the title
File paths in postgraphile handler is not transformed correctly when building for production. (Breaking production build)
File paths in postgraphile handler is not transformed correctly when building for production. (Breaks production build)
Apr 29, 2022
Describe the bug
When setting up the postgraphile handler using file paths like the below example. It does not translate the file paths when building the production output, and throws errors that modules are not found.
example:
This is supposed to load 2 modules, my
./postgraphileOptions.json
file and my./plugins/renameSubscriptionsPlugin
file.Both of these load without any issues when running
mesh dev
, and the schema also builds fine when runningmesh build
.But when running
mesh start
after runningmesh build
I get the following error:If I remove my custom plugin temporarily the error changes too:
This shows that any file paths set in the postgraphile handler does not seem to work when building for production.
Note: using local file paths works just fine when running
mesh dev
. It's only when running it in production it fails.To Reproduce
Add any file path to a postgraphile handler and try to build and start for production.
Expected behavior
The file path should be translated correctly.
I tried to manually go edit the ouputted index.ts file to fix this, and got it working.
since the index.ts imports these as external modules and gives them a set name, I manually tried editing the these 2 lines and got it working:
should be:
and
should be:
and then the server will start with no issues when running
mesh start
Environment:
"@graphile-contrib/pg-simplify-inflector": "^6.1.0",
"@graphql-mesh/cli": "^0.67.4",
"@graphql-mesh/graphql": "^0.23.6",
"@graphql-mesh/openapi": "^0.24.9",
"@graphql-mesh/postgraphile": "^0.20.9",
"@graphql-mesh/runtime": "^0.33.13",
"@graphql-mesh/transform-encapsulate": "^0.3.43",
"@graphql-mesh/transform-filter-schema": "^0.14.47",
"@graphql-mesh/transform-prefix": "^0.11.32",
"@graphql-mesh/transform-rename": "^0.12.33",
"graphql": "^16.3.0"
The text was updated successfully, but these errors were encountered: