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

Updated to 0.3.5 produced critical failure #103

Open
dokutoshi opened this issue Dec 14, 2021 · 8 comments
Open

Updated to 0.3.5 produced critical failure #103

dokutoshi opened this issue Dec 14, 2021 · 8 comments

Comments

@dokutoshi
Copy link

dokutoshi commented Dec 14, 2021

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"
}
@icebob
Copy link
Member

icebob commented Dec 17, 2021

Please create a repro example.

@RiyazMemon
Copy link

RiyazMemon commented Jul 12, 2022

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?

@shawnmcknight
Copy link
Member

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?

@RiyazMemon
Copy link

RiyazMemon commented Jul 12, 2022

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.

@shawnmcknight
Copy link
Member

@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?

@RiyazMemon
Copy link

I got this issue fixed by downgrading my node version. (now it is 14.XX. It was 17.XX earlier)

CC: @shawnmcknight

@shawnmcknight
Copy link
Member

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
[email protected] C:\Users\mck32\Projects\open-source\moleculer-apollo-server
└─┬ [email protected]
  ├─┬ @graphql-tools/[email protected]
  │ └─┬ [email protected]
  │   └── [email protected] deduped
  └─┬ @graphql-tools/[email protected]
    └── [email protected]

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.

@shawnmcknight
Copy link
Member

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.

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

4 participants