Attach debugger to Strapi server - strapi

How to start Strapi with --inspect=0.0.0.0:9229 parameter or any other way to attach the debugger to my server?
This is how I could manage that with alpha version but server.js has been removed since beta:
package.json -> scripts
"debug": "cross-env NODE_ENV=development nodemon --inspect=0.0.0.0:9229 server.js"

Never mind,
node --inspect=0.0.0.0:9229 ./node_modules/.bin/strapi dev
does the trick.

node --inspect=0.0.0.0:9229 ~/path/to/project/node_modules/#strapi/strapi/bin/strapi develop

Related

I have to run cypress component Test but my application is taking approx 17 mins to bootup. So, it is creating timeout error

I am using start-server-and-test but it is giving timeout error after 10 mins. I am following cypress documentation only.
https://docs.cypress.io/guides/continuous-integration/introduction#Boot-your-server
Another package that I used is npm wait-on but it is also not working
"scripts": {
"dev": "cd ../../ && npm run start",
"run:component": "cypress run --spec integration/component_test/*.spec.js",
"componentTest": "npm run dev wait-on http://localhost:3000/ && run:component",
},
I am running "npm run componentTest" but it is not running NEXT_CMD command i.e. run:component
Any suggestion would be really appreciated.
wait-on has a --httpTimeout option, maybe this will work
"componentTest": "npm run dev wait-on --httpTimeout 1020000 http://localhost:3000/ && run:component"
You could potentially wait multiple times and ignore the exit status of all but the last wait invocation.
However I think the main issue here is that run dev and wait-on is not propely running in paralell. Based on this gist the proper invocation should be
"scripts": {
"dev": "cd ../../ && npm run start",
"run:component": "cypress run --spec integration/component_test/*.spec.js",
"componentTest": "concurrently \"npm run dev\" \"wait-on http://localhost:3000/ && npm run run:component\" --kill-others"
},
which will start both concurrently. I added a script similar to this in our project and it worked as intended.
Possibly the start-server-and-test package could be used instead of concurrently.

Do I have to "npm run prod" with every commit to master branch?

I have a Laravel application with a React front-end, which is deployed into an EC2 instance with CodeDeploy-Pipeline + Github.
As I understand, the npm run prod scripts from Laravel Mix (Webpack) should minify the desired assets for production mode, which will have the desired compiled assets for live use.
Since my ec2-deployment will be automatically updated after every commit to master, and supposing that I'm not including my compiled assets from npm run dev - in my case apps.js and app.css- taking me to the loop:
Commit from dev branch to master -> npm run prod -> commit master with minified output assets.
Do I have to run "npm run prod" after every commit to the "master" branch?
Neither Laravel Mix nor Laravel docs are very clear about this or give much advice on the procedure, and in general, found little information about this topic. Are there any usual best practices/WoW for this procedure?

laravel's environment file .env always clean itself during development

I face an issue when in development, my laravel's environment file : .env, usually clean itself whenever I update the client-side code (*.vue files).
I'm using VueJS as client and running the run-time build/watch whenever we have some change, we can refresh the browser to see the change but usually, I don't know why it always clear the laravel .env file to a blank file. It's so annoy.
Fronend command building during the dev:
npm run dev
// or
npm run watch
// configure as
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
Who might face the same issue? Any solution or way to find-out the root cause?
Noted: In production, it's OK. (Laravel 5.8 / VueJS 2.x)

Run Heroku Bash Command 7/24

I have to open the Heroku bash and type "node main.js" to run my app. But when I close my browser the script stops. How can I run the script 24/7?
You seem to be new to heroku, this should help
In your package.json file mention a start script:
"scripts": {
"start": "node main.js",
...
}
(If you don't have a package.json make sure to run npm init -y and commit this file)
And to scale(run) your app:
heroku ps:scale web=1
Your heroku app should automatically be detected as a node application and it would run the start script upon starting
To see the logs and debug, do:
heroku logs --tail --num=10
and then try visiting your app with the terminal open to see live logs
If you have further problems, make sure to include your logs without any credentials possibly leaked

application error when trying to Deploy static website with bootstrap template to heroku

I'm trying to deploy a single page html/css/js site that was built using a bootstrap template to Heroku and continue to get an application error. I've tried some of the hacks I've found online but continue to fail with
npm ERR! missing script: start
as well as, here is the most recent log. Can anyone help?
You need to add in the root of your files, file with name Procfile
and there add this line:
web: node [app.js]
or just add to your package.json file in the scripts this line:
"scripts": {
"start": "node [app.js]"
}
where app.js is the server start file.

Resources