Running BullMQ worker (background process) from a SolidStart project
I have a solidstart project with Redis as its backend. I'm trying to use BullMQ worker: sandboxed processor as the consumer. I'm trying to initialise it during server startup from
entry-middleware.js
as below:
The file worker.client.js
is calling various other modules which has use server
directive set. And, I'm getting the below error. I tried a similar approach from entry-server.js
with the same outcome!!
I did some digging and it seems running background process is a bit of a pain. Has anyone tried doing anything similar? May you please help.Sandboxed processors | BullMQ
Running jobs in isolated processes
GitHub
How to hook into the startup for one-off initialization? · solidjs ...
How does SolidStart execute certain tasks on the server side upon startup, such as background scheduled tasks, similar to using an instrumentation file in NestJS for configuration?
1 Reply
The file worker.client.js
is calling various other modules which has use server directive set.
So the issue is that you are marking entire server modules as accessible by the client which as a consequence restricts their use on the server side.
I'd keep the server code in a plain modules and create separate modules for the "use server"
access points for client RPC.