react-native-job-queue
react-native-job-queue copied to clipboard
TypeError: Cannot read property 'addJob' of null, js engine: hermes
i'm getting this error: TypeError: Cannot read property 'addJob' of null, js engine: hermes
alfter running the example code:
`import queue from 'react-native-job-queue'
queue.configure({onQueueFinish:(executedJobs:Job[])=>{ console.log("Queue stopped and executed",executedJobs) }}); queue.addWorker(new Worker("testWorker",async(payload)=>{ return new Promise((resolve) => { setTimeout(() => { console.log(payload.text); resolve(); }, payload.delay);}); })) queue.addJob("testWorker",{text:"Job example palyoad content text",delay:5000})`
Can you provide more information? Which OS, which react-native version etc.?
sorry: i'm using Android for test.
Enviroment: System: OS: Windows 11 10.0.22631 CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz Memory: 2.10 GB / 15.84 GB Binaries: Node: version: 20.10.0 path: C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: version: 10.2.3 path: C:\Program Files\nodejs\npm.CMD Watchman: version: 20231008.002904.0 path: C:\watchman\bin\watchman.EXE SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: AI-223.8836.35.2231.11005911 Visual Studio: - 17.8.34330.188 (Visual Studio Community 2022) Languages: Java: javac 17 Ruby: Not Found npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.5 wanted: 0.72.5 react-native-windows: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: Not found
I am not able to reproduce the error. Can you provide the full stacktrace?
I was facing this issue, as described for the OP.
The problem seems to be located on jobStore, which should get the NativeModule values
So then I linked the lib manually with npx react-native link react-native-job-queue
.
Hope this helps anyone else.