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

bullmq required module but using bull #167

Closed
heartz66 opened this issue Nov 26, 2020 · 8 comments · Fixed by #171
Closed

bullmq required module but using bull #167

heartz66 opened this issue Nov 26, 2020 · 8 comments · Fixed by #171

Comments

@heartz66
Copy link

I am using bull, not bullmq, and when I try to compile using typescript I receive the following compiler error:

error TS2307: Cannot find module 'bullmq' or its corresponding type declarations.

Meanwhile, the issue is resolved aftering install bullmq

@heartz66 heartz66 changed the title bullmq required module bullmq required module but using bull Nov 26, 2020
@felixmosh
Copy link
Owner

felixmosh commented Nov 26, 2020

What is the file that requires it?

Bullmq is in our devDependencies, if you compile with TS (which is a dev dep) install them :)

@k2s
Copy link

k2s commented Nov 26, 2020

bullmq it is required in dist/index.js. In fact it is never loading bull package.
Do we need to compile own package if we want to use bull ?
Could bull-board except bull library to use on initialization ?

@felixmosh
Copy link
Owner

felixmosh commented Nov 26, 2020

You are right, bullmq is used here https://github.com/vcapretz/bull-board/blob/master/src/index.ts#L43, therefore, it should be a dependency instead of dev dependency.

Regarding this,

Could bull-board except bull library to use on initialization ?

I'm not sure i understood your meaning.

@k2s
Copy link

k2s commented Nov 26, 2020

@felixmosh my quick idea to make bull-board independent from bull version was something like:

const Bull = require('???')

const { router, setQueues } = require('bull-board')
setQueues([q1, q2], Bull)

bull-board would not need to have bull library as dependency or only one as fallback if not provided by user.

@felixmosh
Copy link
Owner

@k2s , Ha got the idea, but there are 2 concerns with it:

  1. bull-board using lib's typescript interfaces
  2. If you pass the instances from out-side, it may break, since bull-board is invoking methods on those instances => api may change => bull-board won't work.

I think that it is better to remove the only usage, and make it a read devDeps.

@vcapretz WDYT?

@vcapretz
Copy link
Contributor

I agree on removing the usage, it seems like it can be solved in other ways, I am just not sure what properties we can look at to decide if it's a queue from bull or bullmq 🤔

@k2s
Copy link

k2s commented Nov 26, 2020

@vcapretz if you need to know which bull library is in use, then what about changing my proposal to use second parameter into options.

setQueues([q1, q2], {bull: require('bull')}l)
// or
setQueues([q1, q2], {bullmq: require('bullmq')}l)

@felixmosh
Copy link
Owner

@vcapretz if you need to know which bull library is in use, then what about changing my proposal to use second parameter into options.

setQueues([q1, q2], {bull: require('bull')}l)
// or
setQueues([q1, q2], {bullmq: require('bullmq')}l)

Thank you for the suggestion, I found more checks like this (https://github.com/vcapretz/bull-board/blob/a0de3877e720230a0dd08a2b262f822a52bb018a/src/routes/cleanAll.ts#L28), we need to refactor the code so it will be agnostic to the lib type.
I've opened an issue for it, #174

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

Successfully merging a pull request may close this issue.

4 participants