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

Crash on start: MODULE_NOT_FOUND error with apollo-engine-reporting > uuid #6254

Closed
3 tasks done
focusaurus opened this issue May 28, 2020 · 16 comments · Fixed by #6292
Closed
3 tasks done

Crash on start: MODULE_NOT_FOUND error with apollo-engine-reporting > uuid #6254

focusaurus opened this issue May 28, 2020 · 16 comments · Fixed by #6292

Comments

@focusaurus
Copy link
Contributor

Prerequisites

  • Are you running the latest version?
  • Are you able to consistently reproduce the issue?
  • Did you search the issue queue for existing issue? Search issues

Issue Description

On startup (working on the v3.8.0 codebase prior to release), the node server is crashing with this error:

(node:285) ExperimentalWarning: The ESM module loader is experimental.
[nodemon] 1.19.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): src/**/*
[nodemon] watching extensions: js,cjs,mjs,json,graphql
[nodemon] starting `node ./src/index.js`
(node:315) ExperimentalWarning: The ESM module loader is experimental.
internal/modules/cjs/loader.js:457
  const e = new Error(`Package exports for '${basePath}' do not define a ` +
            ^

Error: Package exports for '/usr/local/src/app/node_modules/apollo-engine-reporting/node_modules/uuid' do not define a valid '.' target
    at resolveExportsTarget (internal/modules/cjs/loader.js:457:13)
    at resolveExports (internal/modules/cjs/loader.js:390:16)
    at Function.Module._findPath (internal/modules/cjs/loader.js:489:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:780:27)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/local/src/app/node_modules/apollo-engine-reporting/dist/agent.js:26:16)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10) {
  code: 'MODULE_NOT_FOUND'
}
[nodemon] app crashed - waiting for file changes before starting...

Researching online, I think this may be related to this recent update to the uuid npm package.

Our dependency graph to this looks like

a47c90cf3dfe:/usr/local/src/app$ npx npm-remote-ls apollo-server-testing
└─ apollo-server-testing@2.14.1
   │  ├─ apollo-engine-reporting@2.0.0
   │  │  ├─ uuid@8.1.0

We have at least 2 versions of uuid (probably many more), which look at a glance like they should be OK.

a47c90cf3dfe:/usr/local/src/app$ grep '"version":' node_modules/apollo-engine-reporting/node_modules/uuid/package.json node_modules/uuid/package.json
node_modules/apollo-engine-reporting/node_modules/uuid/package.json:  "version": "8.1.0"
node_modules/uuid/package.json:  "version": "3.4.0"

Steps to Reproduce

  1. Try to start reaction core

Note sure what else may be involved yet, still triaging.

Versions

3.8.0

@focusaurus focusaurus added bug For issues that describe a defect or regression in the released software needs triage For issues that are awaiting triage by the core development team labels May 28, 2020
@focusaurus focusaurus self-assigned this May 28, 2020
@focusaurus
Copy link
Contributor Author

I tried updating to apollo-server-testing 2.14.1 but got the same error. It looks like uuid v8.1.0 is properly ready to support ES Modules, but maybe apollo-engine-reporting 2.0.0 is not.

@nchopra
Copy link

nchopra commented May 30, 2020

What node version are you using?
I faced the same issue while using apollo-server-express @ 2.14.1 yesterday, coming from the same module apollo-engine-reporting as you.
I was using node 13.1.0, downgrading it to node 12.8.0 made it work.
Trying to figure out why.

@Vercryger
Copy link

I'm having this issue as well using reaction-api@3.7.1, I haven't found a workaround yet.

@focusaurus
Copy link
Contributor Author

I'm working on the reaction v3.8.0 release which runs node 12.14.1

@amaster507
Copy link

I am running Node 13.2.0 and am getting the same problem. Just updated babel and did a fresh update and install of all modules and started getting this error.

@focusaurus
Copy link
Contributor Author

I can no longer reproduce this and I don't understand repeatable steps to reproduce at the moment. It's the kind of thing that I would think a docker volume rm reaction_api_node_modules would fix but I was having the problem after doing that earlier this week, so still 🤷‍♂️ .

@focusaurus focusaurus added priority medium severity high and removed bug For issues that describe a defect or regression in the released software needs triage For issues that are awaiting triage by the core development team labels Jun 5, 2020
@abhishiv
Copy link

abhishiv commented Jun 6, 2020

I just hit this is well. Must be something to do with babel-node, and node when experimentalModules is on.

@jose31canizar
Copy link

Updating babel with npx babel-upgrade --write fixes the problem in my case.

@zenweasel
Copy link
Collaborator

I am seeing this as well using the current 3.8.0 version. Glad this issue was here to let me know it's somewhat Reaction-related

@zenweasel
Copy link
Collaborator

I've tried all the workarounds mentioned here and still no luck. Interesting to note that I do not get this issue when building from the node-prod:12.14.1-v3 image but do when building from the node/alpine image based on the current dev dockerfile

@loan-laux
Copy link
Collaborator

@zenweasel Did you manage to find a workaround that works?

@zenweasel
Copy link
Collaborator

No. Just went back to my method of restarting the container.

@rochadsouzaiit
Copy link

My Reaction Project only have a couple of plugins installed (for aws s3 storage and a custom IDP). What I did was clone the original project (trunk) and tried to run without my plugins - it worked. After that I added my plugins and... it worked again. Just on my project branch it not works...

ps.: in my case, with node-prod:12.14.1-v3 I still got the same error.

@bjanssen-pon
Copy link

I'm having the same issue only with the dev mode (override of compose file). Did docker system prune, removed container and volume but did not fix the issue. I had it before, but for some reason that error fixed itself. Now stuck on this and I don't know how to fix it. In dev-mode without custom plugins it also doesn't work.

Node version: 12.14.1

@zenweasel
Copy link
Collaborator

fwiw I have build a project with a minimal number of built-in plugins and was still running into this issue

  "dependencies": {
    "@reactioncommerce/api-core": "~1.4.0",
    "@reactioncommerce/api-plugin-accounts": "~1.4.5",
    "@reactioncommerce/api-plugin-authentication": "~1.2.0",
    "@reactioncommerce/api-plugin-authorization-simple": "~1.3.0",
    "@reactioncommerce/api-plugin-settings": "~1.0.2",
    "@reactioncommerce/api-plugin-simple-schema": "~1.0.1",
    "@reactioncommerce/api-plugin-shops": "~1.1.2",
    "@reactioncommerce/api-utils": "~1.14.5",
    "@reactioncommerce/logger": "~1.1.3",
    "@reactioncommerce/random": "~1.0.2",
    "graphql": "~15.3.0",
    "semver": "~7.3.2"
  },

Still had the same. However when I upgraded the build to Node 14.8 the problem went away

focusaurus pushed a commit that referenced this issue Sep 23, 2020
- Hoping this will address #6254

Signed-off-by: Peter Lyons <pete@reactioncommerce.com>
focusaurus pushed a commit that referenced this issue Sep 23, 2020
- Hoping this will address #6254

Signed-off-by: Peter Lyons <pete@reactioncommerce.com>
focusaurus pushed a commit that referenced this issue Sep 23, 2020
- Hoping this will address #6254

Signed-off-by: Peter Lyons <pete@reactioncommerce.com>
focusaurus pushed a commit that referenced this issue Sep 23, 2020
- Hoping this will address #6254

Signed-off-by: Peter Lyons <pete@reactioncommerce.com>
focusaurus pushed a commit that referenced this issue Sep 23, 2020
- Hoping this will address #6254

Signed-off-by: Peter Lyons <pete.lyons@mailchimp.com>
focusaurus pushed a commit that referenced this issue Sep 24, 2020
- Hoping this will address #6254

Signed-off-by: Peter Lyons <pete.lyons@mailchimp.com>
@focusaurus
Copy link
Contributor Author

OK my comment in that PR closed this, which is probably a fairly optimistic take. If anyone has time to pull down the latest trunk branch of reactioncommerce/reaction and test whether both dev and prod mode work without any npm errors, that would be valuable confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants