strapi-community / strapi-tool-dockerize

Easy add support for docker to your strapi project
MIT License
514 stars 35 forks source link

unhandled error on basic script run #43

Closed kinglouie closed 1 year ago

kinglouie commented 1 year ago

🐛 Bug Report

🤷‍♀️ What did you do

When running the example npx @strapi-community/dockerize new --dbclient=mysql --dbhost=localhost --dbport=1234 --dbname=strapi --dbusername=strapi --dbpassword=strapi --projecttype=js --packagemanager=yarn --usecompose=false --env=both I get the error below

When looking into the corresponding code it seems that the projectname is not defined but even if I provide a projectname by argument --projectname=test I get the same error.

⛔️ Error log

🕵️‍♀️ Stack trace

 TypeError: Cannot read property 'toLowerCase' of undefined
    at quickStart (/root/.npm/_npx/26844/lib/node_modules/@strapi-community/dockerize/cli/quickstart.js:23:28)
    at /root/.npm/_npx/26844/lib/node_modules/@strapi-community/dockerize/index.js:35:48
    at Object.<anonymous> (/root/.npm/_npx/26844/lib/node_modules/@strapi-community/dockerize/index.js:57:3)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at /usr/local/lib/node_modules/npm/node_modules/libnpx/index.js:268:14


## 👩‍💻 Environment

- 📦 Node version: 14
- 💻 OS: debian
Eventyret commented 1 year ago

Thanks for this will look into and advise a fix for this.

Eventyret commented 1 year ago

So just tested on @latest and it works here @kinglouie you will need usecompose=true for it to take effect though.

But I would make sure you execute with @latest because this used to be a bug back in the day but was fixed months ago.

kinglouie commented 1 year ago

Thanks a lot! adding @latest fixed the issue.

rit001 commented 1 year ago

I'm going to extend this thread, rather than create a new one as I think the issue is related

After having created a strapi directory I execute the example command line for dockerize with the only change being that of setting --packagemanager=npm (rather than yarn). The result is a cleared screen and the following being displayed

@strapi-community/dockerize v1.9.1 by Simen Daehlin Easy add docker support for a Strapi Project https://github.com/strapi-community/strapi-tool-dockerize

⠋ 🦄 Prepping some magic ✖ UNHANDLED ERROR ✖ ERROR → TypeError ℹ REASON → Cannot read properties of undefined (reading 'toLowerCase') ℹ ERROR STACK ↓ TypeError: Cannot read properties of undefined (reading 'toLowerCase') at quickStart (/home/admin1/.npm/_npx/a642ee8303c0fc2f/node_modules/@strapi-community/dockerize/cli/quickstart.js:23:28) at /home/admin1/.npm/_npx/a642ee8303c0fc2f/node_modules/@strapi-community/dockerize/index.js:35:48 at Object. (/home/admin1/.npm/_npx/a642ee8303c0fc2f/node_modules/@strapi-community/dockerize/index.js:57:3) at Module._compile (node:internal/modules/cjs/loader:1120:14) at Module._extensions..js (node:internal/modules/cjs/loader:1174:10) at Module.load (node:internal/modules/cjs/loader:998:32) at Module._load (node:internal/modules/cjs/loader:839:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47

The message/error is not created if the parameter --projectname= is provided on the commandline.

Eventyret commented 1 year ago

Think i need to add some error handling on this one then @rit001 :) I can see that it was in latest, but what I think it is, is if it's undefined when we create it it will throw that error. Even though the options has a default we can't toLowerCase that value. Will make up a minor fix for this.

Eventyret commented 1 year ago

:tada: This issue has been resolved in version 1.9.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: