Cannot find module 'bullmq'
Closed this issue ยท 13 comments
Hello,
After Bump @appsignal/nodejs from 3.4.4 to 3.4.5
I've got an error :
node_modules/@appsignal/opentelemetry-instrumentation-bullmq/dist/instrumentation.d.ts:2:30 - error TS2307: Cannot find module 'bullmq' or its corresponding type declarations.
2 import type * as bullmq from "bullmq";
Hi @bseverac,
Thank you for reporting this. Could you share your tsconfig.json
file?
Yes off course
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"allowUnreachableCode": false,
"noImplicitThis": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"noUnusedParameters": true,
"alwaysStrict": true,
"strictFunctionTypes": true,
"strict": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"paths": {
"@core/*": ["src/core/*"],
"@config/*": ["src/config/*"],
"@database/*": ["src/database/*"],
"@features/*": ["src/features/*"],
"@infrastructure/*": ["src/infrastructure/*"],
"@stubs/*": ["tests/stubs/*"],
"@integration/*": ["tests/integration/*"],
"@functional/*": ["tests/functional/*"],
"@utils/*": ["tests/utils/*"],
"@migration/*": ["db-migration/*"]
}
}
}
Thank you @bseverac! Sorry to ask for more details, but I am unable to reproduce this issue. Could you share how you initialise AppSignal in your application?
const { Appsignal } = require('@appsignal/nodejs');
new Appsignal({
active: process.env['NODE_ENV'] === 'production',
name: 'xxxx',
pushApiKey: process.env['xxx'] ,
environment: process.env['yyy'],
});
Thank you.
I still can't figure out how to reproduce this. ๐ซ
Would it be possible for you to set up an example repository where the issue takes place that I can clone? I am testing this with different TypeScript versions and I can't reproduce it regardless.
Hi again @bseverac,
While I still have not been able to reproduce it, I believe I have figured out the cause and potentially fixed the issue. Could you run npm update @appsignal/opentelemetry-instrumentation-bullmq
and see if that fixes it for you?
(npm list @appsignal/opentelemetry-instrumentation-bullmq
should show 0.7.1
)
I'm using yarn npm list @appsignal/opentelemetry-instrumentation-bullmq give me 0.7.0
but forcing @appsignal/opentelemetry-instrumentation-bullmq version to 0.7.1 does'nt change anything
The only way i found is to add bullmq into dependencies but i'm not using it don't like this way
When using 0.7.1
, it shouldn't be necessary for bullmq
to be a dependency (as it is now an optional peer dependency) and it shouldn't give you the same error (the line where the error originally appeared doesn't exist anymore in 0.7.1
!)
The equivalent for yarn would be yarn upgrade @appsignal/opentelemetry-instrumentation-bullmq@0.7.1
. Install it, make sure yarn list --pattern @appsignal/opentelemetry-instrumentation-bullmq
returns 0.7.1
, then try it again (without manually installing bullmq
)
If it still gives you an error when compiling, please let me know which error it is (it can't be the exact same error)
Hello thanks you for the help
yarn info @appsignal/opentelemetry-instrumentation-bullmq
โโ @appsignal/opentelemetry-instrumentation-bullmq@npm:0.7.1
โโ Instances: 1
โโ Version: 0.7.1
โ
โโ Dependencies
โโ @opentelemetry/api@npm:^1.3.0 โ npm:1.9.0
โโ @opentelemetry/instrumentation@npm:^0.41.2 โ npm:0.41.2
โโ @opentelemetry/semantic-conventions@npm:^1.25.0 โ npm:1.25.0
And the error
yarn build
node_modules/@appsignal/nodejs/node_modules/@appsignal/opentelemetry-instrumentation-bullmq/dist/instrumentation.d.ts:2:30 - error TS2307: Cannot find module 'bullmq' or its corresponding type declarations.
2 import type * as bullmq from "bullmq";
~~~~~~~~
Found 1 error(s).
Thank you! To be sure, could you run cat node_modules/@appsignal/nodejs/node_modules/@appsignal/opentelemetry-instrumentation-bullmq/package.json | grep version
and check the value?
Yes it's weird
cat node_modules/@appsignal/nodejs/node_modules/@appsignal/opentelemetry-instrumentation-bullmq/package.json | grep version
"version": "0.7.0",
I've try to delete node_module and reinstall without changes
lockfile seen good
"@appsignal/opentelemetry-instrumentation-bullmq@npm:0.7.1":
version: 0.7.1
resolution: "@appsignal/opentelemetry-instrumentation-bullmq@npm:0.7.1"
dependencies:
"@opentelemetry/api": "npm:^1.3.0"
"@opentelemetry/instrumentation": "npm:^0.34.0"
"@opentelemetry/semantic-conventions": "npm:^1.25.0"
flat: "npm:^5.0.2"
peerDependencies:
bullmq: ^2 || ^3 || ^4 || ^5
peerDependenciesMeta:
bullmq:
optional: true
checksum: 65dcb35d18fdfd093cef6ca3b9f88444611892f6efd4125bc7848fa86d5514cbb9377fd6251fcb907d557e8dcefb526d3afe1d97d64e7d2c3e5942771550e8b4
languageName: node
linkType: hard
Right, there's the issue. I'm not sure why Yarn is deciding to put version 0.7.0
in there. Maybe delete the lockfile, or roll it back to before updating @appsignal/nodejs
, then try again from there?
A yes i've got two @appsignal/opentelemetry-instrumentation-bullmq in the lockfile and one was with 0.7.0
I've clean the lockfile and it's ok now
Thanks for the help ๐