skip to Main Content

Using bull-arena: "^3.2.2" version. Facing this error on starting arena dashboard

TypeError: as of 3.0.0, bull-arena requires that the queue constructors be provided to Arena

I tried to use the queue instance as a parameter instead of the queue name but no success.

source code:

import Arena from "bull-arena";
import Bull from "bull";

const queuesConfig = [];
for (const queue in queues) {
  queuesConfig.push({
    name: queues[queue],
    hostId: "worker",
    redis: { url: redisHost }
  });
}

const arenaConfig = Arena({
  queues: queuesConfig
}, {
  basePath: "/",
  disableListen: true,
});

Thanking you in advance for your help.

2

Answers


  1. Chosen as BEST ANSWER

    I have fixed this type-error. PR - #48242
    They have added required constructor condition in bull-arena but didn't update @types/bull-arena. So, we were facing this issue.
    Either we have to provide Bull or Bee constructor to run the code. Now, it will work with import as well.

    import Arena from "bull-arena";
    import Bull from "bull";
    import Bee from "bee-queue";
    

    Bull

    const arenaConfig = Arena({
      Bull,
      queues: queuesConfig
    }, {
      basePath: "/",
      disableListen: true,
    });
    

    Bee

    const arenaConfig = Arena({
      Bee,
      queues: queuesConfig
    }, {
      basePath: "/",
      disableListen: true,
    });
    

    If you don't provide any queue constructor, then it will throw this error.

    TypeError: as of 3.0.0, bull-arena requires that the queue constructors be provided to Arena
    

  2. I met this problem today.

    The solution is as the documentation tells you that you need to specify the library you are supporting.

    It could be clearer in my eyes, but somehow it makes sense. You need to import bull as Bull and add it to the config.

    so add

        const Bull = require('bull');
    

    to the top of the file.

    And add the imported Bull, to the Arena config.

    
        const arenaConfig = Arena({
            Bull,
            queues: queuesConfig
        }, {
            basePath: "/",
            disableListen: true,
        });
    

    Something like this, and it should work. I implemented it in my code and it worked nicely.

        const Arena = require('bull-arena');
    
        // Mandatory import of queue library.
        const Bull = require('bull');
    
        const queuesConfig = [];
    
        for (const queue in queues) {
            console.log(queue, queues[queue]);
            queuesConfig.push({
                name: queues[queue],
                hostId: "worker",
                redis: { url: redisHost }
            });
        }
    
         const arenaConfig = Arena({
             // All queue libraries used must be explicitly imported and included.
             Bull,
             queues: queuesConfig
         }, {
             basePath: "/",
             disableListen: true,
         });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search