Updated to 0.3.5 produced critical failure
dokutoshi opened this issue · 8 comments
See the error message in graphql @shawnmcknight
This run-time error occurs after bumping the revision in package.json.
{
"ts": 1639517617089,
"level": "error",
"msg": "Failed to load service '/services/graphql.service.js' Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './public/extractFiles' is not defined by \"exports\" in /node_modules/apollo-upload-client/node_modules/extract-files/package.json\n at new NodeError (node:internal/errors:371:5)\n at throwExportsNotFound (node:internal/modules/esm/resolve:416:9)\n at packageExportsResolve (node:internal/modules/esm/resolve:669:3)\n at resolveExports (node:internal/modules/cjs/loader:482:36)\n at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)\n at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)\n at Function.Module._load (node:internal/modules/cjs/loader:778:27)\n at Module.require (node:internal/modules/cjs/loader:999:19)\n at require (node:internal/modules/cjs/helpers:102:18)\n at Object.<anonymous> (/node_modules/apollo-upload-client/public/createUploadLink.js:18:20)\n at Module._compile (node:internal/modules/cjs/loader:1095:14)\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)\n at Module.load (node:internal/modules/cjs/loader:975:32)\n at Function.Module._load (node:internal/modules/cjs/loader:822:12)\n at Module.require (node:internal/modules/cjs/loader:999:19)\n at require (node:internal/modules/cjs/helpers:102:18)\n at Object.<anonymous> (/node_modules/apollo-upload-client/public/index.js:3:28)\n at Module._compile (node:internal/modules/cjs/loader:1095:14)\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)\n at Module.load (node:internal/modules/cjs/loader:975:32)\n at Function.Module._load (node:internal/modules/cjs/loader:822:12)\n at Module.require (node:internal/modules/cjs/loader:999:19) {\n code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'\n}",
"nodeID": "local-68225",
"ns": "",
"mod": "broker"
}
Please create a repro example.
See the error message in graphql @shawnmcknight
This run-time error occurs after bumping the revision in package.json.
{ "ts": 1639517617089, "level": "error", "msg": "Failed to load service '/services/graphql.service.js' Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './public/extractFiles' is not defined by \"exports\" in /node_modules/apollo-upload-client/node_modules/extract-files/package.json\n at new NodeError (node:internal/errors:371:5)\n at throwExportsNotFound (node:internal/modules/esm/resolve:416:9)\n at packageExportsResolve (node:internal/modules/esm/resolve:669:3)\n at resolveExports (node:internal/modules/cjs/loader:482:36)\n at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)\n at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)\n at Function.Module._load (node:internal/modules/cjs/loader:778:27)\n at Module.require (node:internal/modules/cjs/loader:999:19)\n at require (node:internal/modules/cjs/helpers:102:18)\n at Object.<anonymous> (/node_modules/apollo-upload-client/public/createUploadLink.js:18:20)\n at Module._compile (node:internal/modules/cjs/loader:1095:14)\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)\n at Module.load (node:internal/modules/cjs/loader:975:32)\n at Function.Module._load (node:internal/modules/cjs/loader:822:12)\n at Module.require (node:internal/modules/cjs/loader:999:19)\n at require (node:internal/modules/cjs/helpers:102:18)\n at Object.<anonymous> (/node_modules/apollo-upload-client/public/index.js:3:28)\n at Module._compile (node:internal/modules/cjs/loader:1095:14)\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)\n at Module.load (node:internal/modules/cjs/loader:975:32)\n at Function.Module._load (node:internal/modules/cjs/loader:822:12)\n at Module.require (node:internal/modules/cjs/loader:999:19) {\n code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'\n}", "nodeID": "local-68225", "ns": "", "mod": "broker" }
Facing the same issue. Any update?
I'm running 0.3.5 in production without any issues, so there must be something different about your setup. @RiyazMemon Can you create a reproduction?
I'm running 0.3.5 in production without any issues, so there must be something different about your setup. @RiyazMemon Can you create a reproduction?
Hey @shawnmcknight, Thanks for a quick response.
I have created a new project using a typescript template (https://github.com/moleculerjs/moleculer-template-project-typescript) and installed npm package moleculer-apollo-server. Followed the usage instruction (https://github.com/moleculerjs/moleculer-apollo-server#usage) and tried running it then I got this error.
@RiyazMemon I'm running the example from this repo (npm run dev
) and everything is working fine. Can you push up a public repo with your codebase that is showing the failure?
I got this issue fixed by downgrading my node version. (now it is 14.XX. It was 17.XX earlier)
CC: @shawnmcknight
OK, I can replicate the problem on Node 17.9.1
. I believe the issue exists on 16.16.0
as well, but it is not treated as fatal.
On 16.16.0
the following is emitted:
(node:900) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./public/" in the "exports" field module resolution of the package at C:\Users\mck32\Projects\open-source\moleculer-apollo-server\node_modules\extract-files\package.json.
Update this package.json to use a subpath pattern like "./public/*".
(Use `node --trace-deprecation ...` to show where the warning was created)
I'm assuming that node 17 has dropped support whatever is generating that deprecation warning. jaydenseric/extract-files#30 is a reference issue for the issue in the extract-files
package and they indicate it was fixed in v10.0.0 of that library.
extract-files
is a transitive dependency from the following:
λ npm ls extract-files
moleculer-apollo-server@0.3.6 C:\Users\mck32\Projects\open-source\moleculer-apollo-server
└─┬ graphql-tools@7.0.5
├─┬ @graphql-tools/links@7.1.0
│ └─┬ apollo-upload-client@14.1.3
│ └── extract-files@9.0.0 deduped
└─┬ @graphql-tools/url-loader@6.10.1
└── extract-files@9.0.0
A big problem here is that versions of graphql-tools
beyond 7.0.5
contain major breaking changes to functionality that would require extensive changes to moleculer-apollo-server
. I will explore if use of package.json
overrides
property might be able to force a later version of extract-files
without an issue.
Adding the following to packge.json
allowed the server to start properly on Node 17 and eliminated the deprecation warning on Node 16:
"overrides": {
"@graphql-tools/links": {
"apollo-upload-client": "^15.0.0"
},
"@graphql-tools/url-loader": {
"extract-files": "^10.0.0"
}
}
Note: The overrides
property is only supported on npm >= 8.3.0.
However, I also noticed that the test suite for moleculer-apollo-server
is failing on Node 17. That may or may not be an issue.