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

TypeError: Cannot destructure property 'name' of '(intermediate value)' as it is undefined. #3164

Closed
1 task done
TVARecordings opened this issue Jan 13, 2024 · 2 comments
Closed
1 task done

Comments

@TVARecordings
Copy link

Are you using the latest version of the library?

  • 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?

Personal account (normal)

Mode

EASY API/CLI

Current Behavior

Whenever a message comes in Client.onMessage(async (message) => {, it cannot read the property's of messages.

Expected Behavior

It is expected to retrieve the property's.

Steps To Reproduce

Client.onMessage(async (message) => {
if (message.type == 'chat'){
  try {
    Handler.messageHandler(Client, message);
    console.log(`[${colors.white.bold(message.chat.name)}] ${MessageTime}  ${colors.blue(message.notifyName)}: ${colors.whiteBright.italic(message.body)}`);
  } catch(err) {
    console.log(err)
  }

}

Note: This isn't the entire script, cut out some unnecessary lines

create() code OR full CLI command + CONFIG

const configObject = {
  sessionId: 'Ameca_13120241940',
  authTimeout: 60,
  autoRefresh: true,
  cacheEnabled: true,
  useChrome: true,
  chromiumArgs: ['--no-sandbox'],
  disableSpins: true,
  headless: false,
  qrRefreshS: 40,
  qrTimeout: 0,
  messagePreprocessor: "AUTO_DECRYPT",
  linkParser: "https://link.openwa.cloud/api",
  restartOnCrash: 'start',
  debug: false,
  logInternalEvents: false, //ONLY TURN THIS ON IF ASKED TO!
  logConsoleErrors: false,
  discord: '234717932175884288',
  ezqr: true,
  //intervalCap: 5, //process 5 events
  //interval: 1000, //within every 1 second window
  //concurrency: 2, //make sure to process, at most, 2 events at any one time
  //timeout: 1000, //make sure there is a 100ms gap between each event processing.
  //carryoverConcurrencyCount: true //If there are more than 5 events in that period, process them within the next 3 second period. Make sure this is always set to true!!!

};

DEBUG INFO

{
  "WA_VERSION": "2.2402.5",
  "WA_AUTOMATE_VERSION": "4.67.0",
  "BROWSER_VERSION": "Chrome/120.0.6099.217",
  "START_TS": 1705188606595,
  "RAM_INFO": "Total: 7.30 GB | Free: 2.74 GB",
  "PPTR_VERSION": "19.11.1",
  "LATEST_VERSION": true,
  "CLI": false,
  "PATCH_HASH": "a391f",
  "LAUNCH_TIME_MS": 15151,
  "ACC_TYPE": "BUSINESS",
  "chats": 19,
  "messages": 71,
  "contacts": 2321,
  "isBiz": true,
  "isMd": true,
  "INSTANCE_ID": "11aeb698-c333-44e4-8a1d-d0d76bcf7061"
}

Environment

- OS: Windows 10
- Node: 18.16.0
- npm: 9.5.1

Screenshots/Logs

console.log([${colors.white.bold(message.chat.name)}] ${MessageTime} ${colors.blue(message.notifyName)}: ${colors.whiteBright.italic(message.body)});
See below:

[Regular group] 0:38:27  Thomas van Amelsvoort: Test 123 (This line is a console.log(), see above)
TypeError: Cannot destructure property 'name' of '(intermediate value)' as it is undefined.
    at module.exports [as messageHandler] (C:\Users\TomVa\Documents\Ameca OpenWA4.67.0 NodeJS18.16.0 Puppeteer21.6.1 Betaaa\handler\messageHandler.js:63:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
PS C:\Users\TomVa\Documents\Ameca OpenWA4.67.0 NodeJS18.16.0 Puppeteer21.6.1 Betaaa> 

Anything else?

Appreciate all the work you've put into wa-automate! Keep up the good work captain <3

@Vinnybrunn00
Copy link

hellow, @TVARecordings!

If Handler.messageHandler returns a promise, try putting await before Handler.messageHandler and see if it works.

If it doesn't solve it, look at this issue, it might help you: https://stackoverflow.com/questions/66340174/cannot-destructure-property-data-of-intermediate-value-as-it-is-undefined

@smashah
Copy link
Member

smashah commented Apr 7, 2024

@TVARecordings please update to the latest version and try again, if it continues then feel free to bump this.

@smashah smashah closed this as completed Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants