Strapi run develop gives frequent server error, plus: getting "an error occured" message when trying to save changes in admin panel and strapi goes into endless load mode

System Information
  • Strapi Version: 3.6.8
  • Operating System: Windows 10
  • Database: MySQL
  • Node Version: v14.17.5
  • NPM Version: 6.14.14
  • Yarn Version:

Hi,

I have two problems (well, maybe more underlying - but at least 2…)

  1. My strapi application frequently stops working when I work in the admin panel - and the error message I usually get in the terminal is when I try to “run develop” again is:

[2021-08-31T17:51:00.966Z] debug :no_entry: Server wasn’t able to start properly.
[2021-08-31T17:51:00.967Z] error Error: connect ETIMEDOUT
at Connection._handleConnectTimeout (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\mysql\lib\Connection.js:409:13)
at Object.onceWrapper (events.js:519:28)
at Socket.emit (events.js:400:28)
at Socket._onTimeout (net.js:484:8)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)
--------------------
at Protocol._enqueue (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at Connection.connect (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\mysql\lib\Connection.js:116:18)
at C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\knex\lib\dialects\mysql\index.js:68:18
at new Promise ()
at Client_MySQL.acquireRawConnection (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\knex\lib\dialects\mysql\index.js:63:12)
at create (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\knex\lib\client.js:290:39)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! osebro-antikvariat@0.1.0 develop: strapi develop
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the osebro-antikvariat@0.1.0 develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\aneth\AppData\Roaming\npm-cache_logs\2021-08-31T17_51_00_996Z-debug.log

*If I close everything down and restart my computer and open a new terminal and try again, usually I am able to access the admin panel again, and everything seems good until I try to make some changes to anything and if I then try to save my changes.

This is also my 2nd problem: strapi admin seems to work fine in develop mode, but when I try to create content type or make any changes, when I save my changes Strapi just goes into an endless loading state, and I cannot do anything more in the admin panel.

Anyone have the slightest idea of what this can be - do I have wrong server settings?
I have a mysql database running on and external host server, and the admin panel running on localhost.

My server.js file is set up like this:
module.exports = ({ env }) => ({

host: env(‘HOST’, ‘0.0.0.0’),

port: env.int(‘PORT’, 1337),

admin: {

auth: {

  secret: env('ADMIN_JWT_SECRET', 'xxxnumberxxx'),

},

},

});

My database.js file looks like this;

module.exports = ({ env }) => ({

defaultConnection: ‘default’,

connections: {

default: {

  connector: 'bookshelf',

  settings: {

    client: 'mysql',

    host: env('DATABASE_HOST', 'xxxusernamexxx.mysql.domeneshop.no'),

    port: env.int('DATABASE_PORT', 3306),

    database: env('DATABASE_NAME', 'xxxnamexxx'),

    username: env('DATABASE_USERNAME', 'xxxusernamexxx'),

    password: env('DATABASE_PASSWORD', 'xxxxpasswordxxx'),

    ssl: env.bool('DATABASE_SSL', true),

  },

  options: {}

},

},

});

Your database is either killing the connection or your database is taking far too long to respond.

Hi @DMehaffy, thanks so much for getting back to me!

-okay, but is there something I can do to fix this?
Also, is that the reason my strapi admin goes into an infinite loading loop and gives me an error when I try to change and save something?

Most likely yes, I’d need more information about your environment to be able to help

if it is potentially fixable then that sounds great, what more information do you need?

Does domeneshop.no publish on port 3306 when using this? also they have some TLS rules so might try to set SSL off. Though check that you can access 3306 port when using it.

Hi @Eventyret, thank you so much for trying to help!:blush:
I’m not sure exactly what you mean by

-this is kind of the only portnumber I have been able to find in relation to the mysql database… Do you know where I can check this, maybe?
-also, I did write and ask domeneshop, and they of course have several restrictions in regards to connections and requests, so this might have something to do with the server connection problems I have been having.

I will (once I hopefully get my Strapi project back up and running again…) try to set the SSL to false and see if that helps - thank you for that suggestion!

This is a long shot, but perhaps you know, I’ve encountered another problem which I have not been able to solve yet - and this has shut me out of the strapi admin panel.
I think I have found the cause of the problem though - my “Strapi generate new” package has a tar package that contains errors. But even though I have the latest tar version installed on my project, for some reason this doesn’t update the tar version in the Strapi generate new package.
So it looks like this:
$ npm list tar
osebro-antikvariat@0.1.0 C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat
±- strapi-generate-new@3.6.8
| -- tar@6.1.4 – tar@6.1.11

I would ask domeneshop about remote connections as in how to connect with a remote tool (Like MySQL workbench etc) if you can use workbench then strapi should work too.

When it comes to the error, I’m not to sure why ya use the tar file or is this an extra package etc ?

Hi again, thanks for the quick reply - much appreciated :blush:

All right, thanks, will double check that.

Well, you have to excuse my “stupidity” here, but I’m completely new to all this, and I’m kind of out of my depth here in regards to this.
I have no idea why I have the tar file - is my honest answer.
But, suddenly, when I was going to open my strapi project yesterday, I ran the run develop command, and it will not open the project, just returns this error:

strapi develop

Building your admin UI with development configuration …
TypeError: The ‘compilation’ argument must be an instance of Compilation
at Function.getCompilationHooks (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\webpack\lib\NormalModule.js:203:10)
at C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\mini-css-extract-plugin\dist\index.js:394:103
at SyncHook.eval [as call] (eval at create (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\HookCodeFactory.js:19:10),
:11:1)
at SyncHook.lazyCompileHook (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\Hook.js:154:20)
at Compiler.newCompilation (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:631:
26)
at C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:667:29
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\HookCodeFactor
y.js:33:10), :6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\Hook.js:154:20)
at Compiler.compile (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:662:28)
at C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:321:11
at Compiler.readRecords (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:529:11)
at C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:318:10
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\HookCodeFactor
y.js:33:10), :6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\Hook.js:154:20)
at C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:315:19
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\HookCodeFactor
y.js:33:10), :15:1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! osebro-antikvariat@0.1.0 develop: strapi develop
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the osebro-antikvariat@0.1.0 develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

And then, if I run npm audit, it gives me this:

                   === npm audit security report ===


                             Manual Review
         Some vulnerabilities require your attention to resolve

      Visit https://go.npm.me/audit-guide for additional guidance

Moderate Regular expression denial of service

Package glob-parent

Patched in >=5.1.2

Dependency of strapi-admin

Path strapi-admin > webpack > watchpack > watchpack-chokidar2 >
chokidar > glob-parent

More info npm

Moderate Regular expression denial of service

Package glob-parent

Patched in >=5.1.2

Dependency of strapi-admin

Path strapi-admin > webpack-dev-server > chokidar > glob-parent

More info npm

High Arbitrary File Creation/Overwrite via insufficient symlink
protection due to directory cache poisoning using symbolic
links

Package tar

Patched in >=4.4.16 <5.0.0 || >=5.0.8 <6.0.0 || >=6.1.7

Dependency of strapi

Path strapi > strapi-generate-new > tar

More info npm

High Arbitrary File Creation/Overwrite via insufficient symlink
protection due to directory cache poisoning using symbolic
links

Package tar

Patched in >=4.4.16 <5.0.0 || >=5.0.8 <6.0.0 || >=6.1.7

Dependency of strapi-generate-new

Path strapi-generate-new > tar

More info npm

High Arbitrary File Creation/Overwrite via insufficient symlink
protection due to directory cache poisoning using symbolic
links

Package tar

Patched in >=4.4.18 <5.0.0 || >=5.0.10 <6.0.0 || >=6.1.9

Dependency of strapi

Path strapi > strapi-generate-new > tar

More info npm

High Arbitrary File Creation/Overwrite via insufficient symlink
protection due to directory cache poisoning using symbolic
links

Package tar

Patched in >=4.4.18 <5.0.0 || >=5.0.10 <6.0.0 || >=6.1.9

Dependency of strapi-generate-new

Path strapi-generate-new > tar

More info npm

High Arbitrary File Creation/Overwrite on Windows via
insufficient relative path sanitization

Package tar

Patched in >=4.4.18 <5.0.0 || >=5.0.10 <6.0.0 || >=6.1.9

Dependency of strapi

Path strapi > strapi-generate-new > tar

More info npm

High Arbitrary File Creation/Overwrite on Windows via
insufficient relative path sanitization

Package tar

Patched in >=4.4.18 <5.0.0 || >=5.0.10 <6.0.0 || >=6.1.9

Dependency of strapi-generate-new

Path strapi-generate-new > tar

More info npm

found 8 vulnerabilities (2 moderate, 6 high) in 1722 scanned packages
8 vulnerabilities require manual review. See the full report for details.

So, I tried installing the latest version of tar (as I though that would be the right thing to do…) and the version is updated in my project, but not in the strapi-generate-new package - which as far as I can understand is the reason for the errors above?

I would say that you can do a quick test on something.

  1. Delete node_modules folder
  2. Delete the .tar file.
  3. run npm install inside the strapi project.
  4. run npm run develop to see if it spins up

If this does not work could you post the content of your package.json file please :slight_smile:

1 Like

ehhhm… where exactly can I find the .tar file?:woozy_face:

Well if it’s not in the root skip the step

pfffh - sorry for being, well you know.

Is it strange that if I delete node.modules, and run npm audit, it still returns the errors from the node.modules folder
I tried clearing the cache, but it didn’t make any difference?

Should I just continue on your list and try to install again?

Hi again, I tried to do this, but

but no success I’m afraid - I still get the same error message (2 moderate & 3high severity vulnerabilities), so here is my package.json file :slightly_smiling_face:

{

“name”: “osebro-antikvariat”,

“private”: true,

“version”: “0.1.0”,

“description”: “A Strapi application”,

“scripts”: {

"develop": "strapi develop",

"start": "strapi start",

"build": "strapi build",

"strapi": "strapi"

},

“dependencies”: {

"chokidar": "^3.5.2",

"css-loader": "^6.2.0",

"glob-parent": "^6.0.1",

"jquery": "^3.6.0",

"knex": "0.21.18",

"mysql": "2.18.1",

"strapi": "^3.6.8",

"strapi-admin": "3.6.8",

"strapi-connector-bookshelf": "3.6.8",

"strapi-plugin-content-manager": "3.6.8",

"strapi-plugin-content-type-builder": "3.6.8",

"strapi-plugin-email": "3.6.8",

"strapi-plugin-i18n": "3.6.8",

"strapi-plugin-upload": "3.6.8",

"strapi-plugin-users-permissions": "3.6.8",

"strapi-utils": "3.6.8",

"tar": "^6.1.11",

"url-loader": "^4.1.1",

"webpack": "^5.51.1"

},

“author”: {

"name": "A Strapi developer"

},

“strapi”: {

"uuid": "e441a5ea-6f26-47bd-b368-139f1cb3da35"

},

“engines”: {

"node": ">=10.16.0 <=14.x.x",

"npm": ">=6.0.0"

},

“license”: “MIT”

}

For not ignore the audit as it’s not an error it’s a warning about packages, not much you can control unless you want to edit the package.json manually etc. So just leave it out. If you do npm run develop does strapi then start as normal ?

Hi again, :slightly_smiling_face:

No, strapi will not open, and I just get this error message:

$ npm run develop

osebro-antikvariat@0.1.0 develop C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat
strapi develop

Building your admin UI with development configuration …
TypeError: The ‘compilation’ argument must be an instance of Compilation
at Function.getCompilationHooks (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\webpack\lib\NormalModule.js:203:10)
at C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\mini-css-extract-plugin\dist\index.js:394:103
at SyncHook.eval [as call] (eval at create (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\HookCodeFactory.js:19:10),
:11:1)
at SyncHook.lazyCompileHook (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\Hook.js:154:20)
at Compiler.newCompilation (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:631:
26)
at C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:667:29
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\HookCodeFactor
y.js:33:10), :6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\Hook.js:154:20)
at Compiler.compile (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:662:28)
at C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:321:11
at Compiler.readRecords (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:529:11)
at C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:318:10
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\HookCodeFactor
y.js:33:10), :6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\Hook.js:154:20)
at C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\strapi-admin\node_modules\webpack\lib\Compiler.js:315:19
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\aneth\OneDrive\FEU 2021\Exam Osebro Antique Book Store\osebro-antikvariat\node_modules\tapable\lib\HookCodeFactor
y.js:33:10), :15:1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! osebro-antikvariat@0.1.0 develop: strapi develop
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the osebro-antikvariat@0.1.0 develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\aneth\AppData\Roaming\npm-cache_logs\2021-09-02T16_21_18_334Z-debug.log

I’m going to say @DMehaffy can you shed any light on this? :slight_smile: Sorry for the tag hope that is ok :pray:

Only thing I can think of is what version of npm are you using @Ane_Th ? npm -version will tell you this.

1 Like

First things first, please don’t rely on npm’s audit. I won’t dive into specific unless people really care to know, but simply put it’s a pointless system that only accounts for 33% of a problem and cause false sense of (or lack of) security.

First things I need to ask:

  • What node version do you have
  • What npm version do you have
  • Are you using yarn

This to me looks like someone ran an npm audit --fix which resolved package versions that had breaking changes or you are missing some depends for the libvips depends from Sharp (usually requires that you have python installed).

Keep in mind I very very rarely use windows anymore (Linux Mint for the win) but I cannot reproduce this issue on my Windows 10 box.

2 Likes

@Eventyret and @DMehaffy , thank you both for trying to help me - I am really very grateful!

I have
npm 6.14.15
node v14.17.6
using npm (not yarn)

I did try to open another strapi project, and this opens fine when I just ignore the pointless :wink: messages from audit and run develop (I still get the same vulnerability messages there about the tar files etc),

So, it is probably as you say @DMehaffy - that I did something stupid like trying to run audit fix in some kind of desperation to fix my problems and ignoring the breaking changes message… probably. (:see_no_evil:)

Okay, so I do not know if this helps in any way, but the package.json file on the strapi that works is:

{
  "name": "api",
  "private": true,
  "version": "0.1.0",
  "description": "Noroff Semester project 2",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "devDependencies": {},
  "dependencies": {
    "knex": "<0.20.0",
    "sqlite3": "latest",
    "strapi": "^3.6.8",
    "strapi-admin": "^3.6.8",
    "strapi-connector-bookshelf": "^3.6.8",
    "strapi-plugin-content-manager": "^3.6.8",
    "strapi-plugin-content-type-builder": "^3.6.8",
    "strapi-plugin-email": "^3.6.8",
    "strapi-plugin-upload": "^3.6.8",
    "strapi-plugin-users-permissions": "^3.6.8",
    "strapi-utils": "^3.6.8"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "8715cbed-a6ed-4700-bc41-444293351d4e"
  },
  "engines": {
    "node": ">=10.0.0",
    "npm": ">=6.0.0"
  },
  "license": "MIT"
}

-While the package.json on the stapi that will not run is:

{
  "name": "osebro-antikvariat",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "dependencies": {
    "chokidar": "^3.5.2",
    "css-loader": "^6.2.0",
    "glob-parent": "^6.0.1",
    "jquery": "^3.6.0",
    "knex": "0.21.18",
    "mysql": "2.18.1",
    "strapi": "^3.6.8",
    "strapi-admin": "3.6.8",
    "strapi-connector-bookshelf": "3.6.8",
    "strapi-plugin-content-manager": "3.6.8",
    "strapi-plugin-content-type-builder": "3.6.8",
    "strapi-plugin-email": "3.6.8",
    "strapi-plugin-i18n": "3.6.8",
    "strapi-plugin-upload": "3.6.8",
    "strapi-plugin-users-permissions": "3.6.8",
    "strapi-utils": "3.6.8",
    "tar": "^6.1.11",
    "url-loader": "^4.1.1",
    "webpack": "^4.46.0"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "e441a5ea-6f26-47bd-b368-139f1cb3da35"
  },
  "engines": {
    "node": ">=10.16.0 <=14.x.x",
    "npm": ">=6.0.0"
  },
  "license": "MIT"
}

-And even I can see that I have a lot of stuff going on in the strapi project that doesn’t work…
(I have python installed - Python3.9)

Thanks @DMehaffy :slight_smile: So I wasn’t to much off then :stuck_out_tongue: :ghost:

But I’m glad you more or less go tit sorted @Ane_Th as @DMehaffy ignore the npm audit and you will be fine itht he project.

1 Like