wa-automate-nodejs icon indicating copy to clipboard operation
wa-automate-nodejs copied to clipboard

--config when run npx doesn't work

Open silvaartur opened this issue 2 years ago • 8 comments

Are you using the latest version of the library?

  • [X] I have checked and am using the latest version of the library.

What type of session are you experiencing this issue on?

Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag

What type of host account are you experiencing this issue on?

Business account

Mode

EASY API/CLI

Current Behavior

Got a message: "unable to read config file json: (...).config.json"

Expected Behavior

Accept and load config variables

Steps To Reproduce

Run: npx @open-wa/wa-automate --config (...).config.json Receive: Unable to read config file json: (...).config.json

create() code OR full CLI command + CONFIG

No response

DEBUG INFO

{
  "WA_VERSION": "2.2232.8",
  "WA_AUTOMATE_VERSION": "4.46.0",
  "BROWSER_VERSION": "HeadlessChrome/103.0.5058.0",
  "START_TS": 1662388888020,
  "RAM_INFO": "Total: 2.03 GB | Free: 1.42 GB",
  "PPTR_VERSION": "15.0.0",
  "LATEST_VERSION": true,
  "CLI": true
}

Environment

- OS: Linux 5.15
- Node: 17.9.0
- npm: 8.10.0

Screenshots/Logs

No response

Anything else?

No response

silvaartur avatar Sep 05 '22 15:09 silvaartur

Adding --verbose result:

info: Set up logging for console {"timestamp":"2022-09-05T15:01:30.067Z"} info: Config /dados/(...).config.json is directory: false {"timestamp":"2022-09-05T15:01:30.070Z"} info: Checking exists: /dados/(...).config.json {"timestamp":"2022-09-05T15:01:30.071Z"} info: Attempting to open: /dados/(...).config.json {"timestamp":"2022-09-05T15:01:30.071Z"} info: /dados/(...).config.json is valid {"timestamp":"2022-09-05T15:01:30.073Z"} Unable to read config file json: /dados/(...).config.json info: Using config file: ??? {"timestamp":"2022-09-05T15:01:30.074Z"}

silvaartur avatar Sep 05 '22 15:09 silvaartur

@silvaartur what's the cli command you're using?

smashah avatar Sep 05 '22 15:09 smashah

npx @open-wa/wa-automate --config (...).config.json

silvaartur avatar Sep 05 '22 17:09 silvaartur

@smashah I found the problem. I set --config as absolute path on past versions... doesn't work this way on currently version.

silvaartur avatar Sep 05 '22 17:09 silvaartur

Using /getConfig discovered my config.json is not loaded completed... like licensekey value for example.

silvaartur avatar Sep 05 '22 18:09 silvaartur

@silvaartur Please add the whole path as you set it:

npx @open-wa/wa-automate --config (...).config.json

it's best to just change sensitive info instead of redact it completely along with other text

smashah avatar Sep 06 '22 20:09 smashah

Happen on >= 4.44.4

Running:

npx --yes @open-wa/wa-automate --config /data/1999123456.config.json --pm2 "--max-memory-restart 1G --name 1999123456"

or

npx --yes @open-wa/wa-automate --config 1999123456.config.json --pm2 "--max-memory-restart 1G --name 1999123456"

or

npx --yes @open-wa/wa-automate --config ./1999123456.config.json --pm2 "--max-memory-restart 1G --name 1999123456"

silvaartur avatar Sep 12 '22 16:09 silvaartur

Facing this issue too .

m7mdcc avatar Sep 22 '22 19:09 m7mdcc

currently experiencing this issue too

UnpopularOpinion avatar Oct 10 '22 13:10 UnpopularOpinion

smh this was literally a one word fix. Just needed to await a promise. Thanks for your patience

smashah avatar Oct 13 '22 01:10 smashah

@github-actions run

⚡ Release! ⚡
(async () => {
function exec(cmd) {
  console.log(execSync(cmd).toString());
}
//set the version type
process.env.VERS = "patch"

// Config
const gitUserEmail = "github-actions[bot]@users.noreply.github.com";
const gitUserName = "github-actions[bot]";

exec(`echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc`);
exec(`git config --global user.email "${gitUserEmail}"`);
exec(`git config --global user.name "${gitUserName}"`);
exec(`npm i -D`);
exec(`npm run release-ci $VERS`);

// types only package
exec('npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN')
exec(`cd ./types-only && npm version $VERS && npm run build && npm publish && cd ..`);
exec(`git commit -a -m 'updated types-only package'`);
exec(`git push --force`);

//comment on the issue
var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString();

    await postComment(result);

//create changelog image
exec(`npm run release-image`);
exec(`git commit -a -m 'updated release-image'`);
exec(`git push --force`);
  })();

smashah avatar Oct 13 '22 01:10 smashah

Changelog

🚀 Release 4.47.2 (2022-10-13)

  • Release 4.47.2 a93448a
  • 🐛 fix --config json open race condition #2874 6c1d63c
  • updated types-only package 5b5c11a

smashah avatar Oct 13 '22 01:10 smashah