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

Strapi crash - ERR_INTERNAL_ASSERTION: This is caused by either a bug in Node.js or incorrect usage of Node.js internals. #18084

Closed
Cretezy opened this issue Sep 15, 2023 · 27 comments
Labels
issue: bug Issue reporting a bug severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve source: dependencies Source is dependency problem status: confirmed Confirmed by a Strapi Team member or multiple community members

Comments

@Cretezy
Copy link

Cretezy commented Sep 15, 2023

Bug report

Required System information

  • Node.js version: v20.5.1
  • NPM version: 9.8.0
  • Strapi version: 4.13.6, seems to also happen on 4.12
  • Database: SQLite
  • Operating system: Linux, Unraid 6.12.4, Docker node:20.5.1-alpine
  • Is your project Javascript or Typescript: TypeScript

Describe the bug

Strapi crashes. Seems to only be happening when hitting /graphql.

Have not been able to find which query is causing this, will be able to this weekend.

Here are the logs:

...
[2023-09-15 09:32:33.822] http: POST /graphql (7 ms) 200
[2023-09-15 09:32:33.832] http: POST /graphql (6 ms) 200
[2023-09-15 09:32:33.844] http: POST /graphql (6 ms) 200
[2023-09-15 09:32:33.855] http: POST /graphql (8 ms) 200
[2023-09-15 09:32:34.718] http: POST /graphql (860 ms) 200
node:internal/assert:14
    throw new ERR_INTERNAL_ASSERTION(message);
    ^

Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues

    at new NodeError (node:internal/errors:405:5)
    at assert (node:internal/assert:14:11)
    at internalConnectMultiple (node:net:1118:3)
    at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  code: 'ERR_INTERNAL_ASSERTION'
}

Node.js v20.5.1
npm notice 
npm notice New major version of npm available! 9.8.0 -> 10.1.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.1.0>
npm notice Run `npm install -g npm@10.1.0` to update!
npm notice 

Steps to reproduce the behavior

TBD, unsure yet. Will post this weekend.

Expected behavior

Strapi does not crash.

@Cretezy
Copy link
Author

Cretezy commented Sep 15, 2023

I couldn't figure out which query was causing this, or why it started happening.

We wanted to switch to Postgres recently, and switching fixed this issue. Seems like it may be a SQLite only issue (we used better-sqlite for reference). Closing as it's no longer a problem and not able to reproduce it consistently.

@Cretezy Cretezy closed this as completed Sep 15, 2023
@dohoangtung
Copy link

image

Same issue -

@nicolasjuan
Copy link

nicolasjuan commented Oct 25, 2023

Same here (using SQLite). It happens when the server restarts to save any changes.
image

@89224747505
Copy link

Same here . I use Postgres. It happens when the server restarts to save changes in collections.

@nicolasjuan
Copy link

I think that's because node v20. I go back to version 18 and works fine, as expected.

@klonwar
Copy link

klonwar commented Dec 5, 2023

Still reproducing on Node 20.8.1 with Strapi 4.15.5
Works fine on Node 18.17.0

@conradkirschner
Copy link

why is this issue closed?

@sawden
Copy link

sawden commented Dec 22, 2023

Still an Issue with:
Node 20.10.0
Strapi 4.16.0 with sqlite

image

@Cretezy Cretezy reopened this Dec 22, 2023
@Cretezy
Copy link
Author

Cretezy commented Dec 22, 2023

Reopening as others have the issues.

@ancashoria
Copy link

Same here, Strapi 4.16.2 (node v20.10.0)

@derrickmehaffy derrickmehaffy added the status: can not reproduce Not enough information to reproduce label Dec 25, 2023
Copy link
Contributor

This is a templated message

Hello @Cretezy,

Thank you for reporting this bug, however we are unable to reproduce the issue you described given the information we have on hand. Can you please create a fresh project that you are able to reproduce the issue in, provide clear steps to reproduce this issue, and either upload this fresh project to a new GitHub repo or compress it into a .zip and upload it on this issue?

We would greatly appreciate your assistance with this, by working in a fresh project it will cut out any possible variables that might be unrelated.
Please note that issues labeled with status: can not reproduce will be closed in 14 days if there is no activity.

Thank you!

@pashioz
Copy link

pashioz commented Dec 25, 2023

I had the issue as well, was on Node.js v20.10.0, reverted to Node.js v18.19.0, seems to working ok now.

Strapi v4.16.2

@dxps
Copy link

dxps commented Jan 2, 2024

Same here, using Strapi v4.16.2 on Node.js v20.10.0 on Linux (Pop!_OS 22.04 LTS).

It happened right after playing a bit with an initial content type, while learning it. Sample available here.

…/backend on  master [?] ❯ npm run develop

> backend@0.1.0 develop
> strapi develop

✔ Cleaning dist dir (10ms)
⠋ Building build context
[INFO] Including the following ENV variables as part of the JS bundle:
    - ADMIN_PATH
    - STRAPI_ADMIN_BACKEND_URL
    - STRAPI_TELEMETRY_DISABLED
✔ Building build context (50ms)
✔ Creating admin (13698ms)
✔ Loading Strapi (844ms)
✔ Generating types (359ms)
✔ Cleaning dist dir (6ms)
✔ Compiling TS (1428ms)
node:internal/assert:14
    throw new ERR_INTERNAL_ASSERTION(message);
    ^

Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues

    at assert (node:internal/assert:14:11)
    at internalConnectMultiple (node:net:1118:3)
    at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  code: 'ERR_INTERNAL_ASSERTION'
}

Node.js v20.10.0
…/backend on  master [?] took 21s❯

Indeed, as @pashioz kindly mentioned, it (still) works using Node v18.
The switch is easily done using nvm, of course:

…/backend on  master [?] took 21s❯ nvm install v18
Downloading and installing node v18.19.0...
Downloading https://nodejs.org/dist/v18.19.0/node-v18.19.0-linux-x64.tar.xz...
################################################################################################################################# 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v18.19.0 (npm v10.2.3)
…/backend on  master took 3s❯ which node
/home/devs/.nvm/versions/node/v18.19.0/bin/node
…/backend on  master ❯

And the result:

…/backend on  master ❯ npm run develop

> backend@0.1.0 develop
> strapi develop

✔ Cleaning dist dir (7ms)
⠋ Building build context
[INFO] Including the following ENV variables as part of the JS bundle:
    - ADMIN_PATH
    - STRAPI_ADMIN_BACKEND_URL
    - STRAPI_TELEMETRY_DISABLED
✔ Building build context (47ms)
✔ Creating admin (11620ms)
✔ Loading Strapi (857ms)
✔ Generating types (330ms)
✔ Cleaning dist dir (4ms)
✔ Compiling TS (1646ms)

 Project information                                                          

┌────────────────────┬──────────────────────────────────────────────────┐
│ Time               │ Tue Jan 02 2024 18:26:09 GMT+0200 (Eastern Euro… │
│ Launched in        │ 2844 ms                                          │
│ Environment        │ development                                      │
│ Process PID        │ 129676                                           │
│ Version            │ 4.16.2 (node v18.19.0)                           │
│ Edition            │ Community                                        │
│ Database           │ postgres                                         │
└────────────────────┴──────────────────────────────────────────────────┘

 Actions available                                                            

Welcome back!
To manage your project 🚀, go to the administration panel at:
http://localhost:1337/admin

To access the server ⚡️, go to:
http://localhost:1337

@edoardo-bluframe
Copy link

Same here on Postgres and Node v20.9.0!

@pashioz
Copy link

pashioz commented Jan 11, 2024

I have just upgraded to Strapi v4.17.0, seems to work without error with Node 20.10.0 so far.

EDIT: Spoke to soon, works 50% of the time.

@derrickmehaffy
Copy link
Member

So far we haven't been able to reproduce this at all on any version. If someone could provide exact reproduction steps that we be awesome 👍

@pashioz
Copy link

pashioz commented Jan 11, 2024

@derrickmehaffy it's pretty much just running strapi develop whilst using node v20.10.0 in my case, node v20.11.0 produces the same error.

Ubuntu 23.04

➜  backend git:(develop) nvm use 20.10.0 
Now using node v20.10.0 (npm v10.2.5)
➜  backend git:(develop) yarn run develop
yarn run v1.22.21
$ strapi develop
✔ Cleaning dist dir (14ms)
⠋ Building build context
[INFO] Including the following ENV variables as part of the JS bundle:
    - ADMIN_PATH
    - STRAPI_ADMIN_BACKEND_URL
    - STRAPI_TELEMETRY_DISABLED
✔ Building build context (41ms)
✔ Creating admin (12172ms)
✔ Loading Strapi (680ms)
✔ Generating types (395ms)
✔ Cleaning dist dir (7ms)
✔ Compiling TS (1708ms)
node:internal/assert:14
    throw new ERR_INTERNAL_ASSERTION(message);
    ^

Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues

    at assert (node:internal/assert:14:11)
    at internalConnectMultiple (node:net:1118:3)
    at Timeout.internalConnectMultipleTimeout (node:net:1687:3)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  code: 'ERR_INTERNAL_ASSERTION'
}

Node.js v20.10.0
Done in 19.66s.

@derrickmehaffy
Copy link
Member

In that case then I can 100% confirm that isn't reproducable accurately because my default node version I use regularly is Node 20 on Linux Mint 21.2 (based on Ubuntu 22.04) and I spin up at least 10 to 15 projects a day and have never seen it.

Meaning there is some other environmental factor at play here that we need to identify. If we can't accurately reproduce the issue we can't fix it and validate our fix.

@karabo-betika
Copy link

I running the project in a MacBook Pro Apple M1 Pro with

  • Node v20.0.0
  • NPM 9.6.4
  • Strapi 4.17.0
  • Database: MySQL
  • Operating system: macOS Sonoma 14.2.1

hope it helps

@derrickmehaffy
Copy link
Member

In the process of testing another bug I still was unable to confirm this, brand new project on node 20 using our latest version (with SQLite) and I don't hit the issue (even after creating a new content-type)

image

@edoardo-bluframe
Copy link

I downgraded to Node 18.19.0 now all good. For the record in my case it was happening in production on Node 20.9.0, and in a K8 container

@derrickmehaffy
Copy link
Member

Anyone else here using docker or other containers and running in production?

@karabo-betika
Copy link

I downgraded to Node 18.19.0 now all good. For the record in my case it was happening in production on Node 20.9.0, and in a K8 container

Yes downgrading seems to be the only solution at the moment. As I downgraded to Node v18.17.0 and didn't get the issue anymore.

@edoardo-bluframe
Copy link

@derrickmehaffy Actually seems to be a bug in Node nodejs/node#47644

Already merged in. I dug more when it started appearing for me not just in Strapi but in a GraphQL deployment!

@derrickmehaffy
Copy link
Member

Ahh seems to be an issue in Node's network stack, should be fixed by this when it's released: nodejs/node#51045

I'll tag this correctly and close it for now since it's out of our hands but good find!

@derrickmehaffy derrickmehaffy added issue: bug Issue reporting a bug severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve status: confirmed Confirmed by a Strapi Team member or multiple community members source: dependencies Source is dependency problem and removed status: can not reproduce Not enough information to reproduce labels Jan 12, 2024
@jafaruddeen
Copy link

Using Node v20.0.1 and getting the same issue while installing the Strapi v4.17.0

Screenshot 2024-01-16 at 6 51 11 AM

But downgraded the version of Node v18.18.0 and installed Strapi v4.17.0 without any issues.

@derrickmehaffy
Copy link
Member

Using Node v20.0.1 and getting the same issue while installing the Strapi v4.17.0

Screenshot 2024-01-16 at 6 51 11 AM

But downgraded the version of Node v18.18.0 and installed Strapi v4.17.0 without any issues.

As mentioned before this isn't us and there is quite literally nothing we can do about it, this issue happens with entirely different projects and boils down to a bug within node itself.

Locking this thread.

@strapi strapi locked and limited conversation to collaborators Jan 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue: bug Issue reporting a bug severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve source: dependencies Source is dependency problem status: confirmed Confirmed by a Strapi Team member or multiple community members
Projects
Archived in project
Development

No branches or pull requests