WordPress / wordpress-playground

Run WordPress in the browser via WebAssembly PHP
https://w.org/playground/
GNU General Public License v2.0
1.57k stars 221 forks source link

Issues with logging #1514

Open robertsreberski opened 2 weeks ago

robertsreberski commented 2 weeks ago

Error message:

TypeError: Cannot set property message of #<ErrorEvent2> which has only a getter
    at logToConsole (/Users/robertsreberski/Documents/opensource/wp-ai-assistant/node_modules/@wp-playground/cli/node_modules/@php-wasm/node/index.cjs:72088:26)
    at Logger.logMessage (/Users/robertsreberski/Documents/opensource/wp-ai-assistant/node_modules/@wp-playground/cli/node_modules/@php-wasm/node/index.cjs:72166:7)
    at Logger.error (/Users/robertsreberski/Documents/opensource/wp-ai-assistant/node_modules/@wp-playground/cli/node_modules/@php-wasm/node/index.cjs:72244:10)
    at UnhandledRejectionsTarget.errorListener (/Users/robertsreberski/Documents/opensource/wp-ai-assistant/node_modules/@wp-playground/cli/node_modules/@php-wasm/node/index.cjs:73299:18)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
    at UnhandledRejectionsTarget.dispatchEvent (node:internal/event_target:742:26)
    at runtime.asm.<computed> (/Users/robertsreberski/Documents/opensource/wp-ai-assistant/node_modules/@wp-playground/cli/node_modules/@php-wasm/node/index.cjs:72428:20)
    at invoke_iiiii (/Users/robertsreberski/Documents/opensource/wp-ai-assistant/node_modules/@wp-playground/cli/node_modules/@php-wasm/node/index.cjs:11184:14)
    at php_execute_script (wasm://wasm/03a6497a:wasm-function[11898]:0x67970a)
    at dynCall_ii (wasm://wasm/03a6497a:wasm-function[13862]:0x755245)

Steps to recreate:

  1. Run npx @wp-playground/cli server
  2. Install openai-php library: https://github.com/openai-php/client
  3. Set it up and run the basic example (e.g. in plugin's php code)
  4. The error will araise
bgrgicak commented 2 days ago

Unrelated but also important. This is how the error message output looks in CLI and probably WP-NOW. @sejas what would we like the error output to be in WP-NOW?

Screenshot 2024-07-01 at 12 55 51