TS2688: Cannot find type definition file for 'mime' in @clerk/clerk-sdk-node
shadoworion opened this issue ยท 7 comments
Preliminary Checks
- I have reviewed the documentation: https://clerk.com/docs
- I have searched for existing issues: https://github.com/clerk/javascript/issues
- I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
- This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction
https://github.com/clerk/javascript
Publishable key
pk_test_ZGVjZW50LW1vbGUtNy5jbGVyay5hY2NvdW50cy5kZXYk
Description
Steps to reproduce:
- Install @clerk/clerk-sdk-node@latest in node typescript project.
- Run "tsc" (build).
When I remove "@clerk/clerk-sdk-node" - there is no type error.
Expected behavior:
Complete build
Actual behavior:
error TS2688: Cannot find type definition file for 'mime'.
The file is in the program because:
Entry point for implicit type library 'mime'
Environment
System:
OS: macOS 14.3.1
CPU: (11) arm64 Apple M3 Pro
Memory: 789.16 MB / 18.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.10.0 - /usr/local/bin/node
Yarn: 1.22.21 - /usr/local/bin/yarn
npm: 10.2.5 - /usr/local/bin/npm
bun: 1.0.36 - ~/.bun/bin/bun
Browsers:
Chrome: 123.0.6312.87
Edge: 123.0.2420.65
Safari: 17.3.1
npmPackages:
@aws-sdk/client-cloudwatch-logs: ^3.540.0 => 3.540.0
@aws-sdk/client-ecs: ^3.540.0 => 3.542.0
@aws-sdk/client-lambda: ^3.540.0 => 3.540.0
@aws-sdk/client-s3: ^3.540.0 => 3.540.0
@aws-sdk/s3-request-presigner: ^3.540.0 => 3.540.0
@bloxtax/extras: ^1.0.7 => 1.0.7
@clerk/clerk-sdk-node: ^4.13.11 => 4.13.11
@graphql-yoga/plugin-response-cache: ^3.4.0 => 3.5.0
@pothos/core: ^3.41.0 => 3.41.0
@pothos/plugin-dataloader: ^3.18.1 => 3.18.1
@pothos/plugin-prisma: ^3.65.0 => 3.65.0
@prisma/client: ^5.11.0 => 5.11.0
@sendgrid/mail: ^8.1.1 => 8.1.1
@solana/web3.js: ^1.91.1 => 1.91.2
@types/crypto-js: ^4.2.2 => 4.2.2
@types/node: ^20.11.30 => 20.12.2
@types/pg: ^8.11.4 => 8.11.4
@types/uuid: ^9.0.8 => 9.0.8
@whatwg-node/server-plugin-cookies: ^1.0.2 => 1.0.2
axios: ^1.6.8 => 1.6.8
crypto-js: ^4.2.0 => 4.2.0
dataloader: ^2.2.2 => 2.2.2
dayjs: ^1.11.10 => 1.11.10
dotenv: ^16.4.5 => 16.4.5
form-data: ^4.0.0 => 4.0.0
graphql: ^16.8.1 => 16.8.1
graphql-middleware: ^6.1.35 => 6.1.35
graphql-request: ^6.1.0 => 6.1.0
graphql-scalars: ^1.23.0 => 1.23.0
graphql-shield: ^7.6.5 => 7.6.5
graphql-yoga: ^5.2.0 => 5.3.0
knex: ^3.1.0 => 3.1.0
libphonenumber-js: ^1.10.58 => 1.10.59
node-object-hash: ^3.0.0 => 3.0.0
pg: ^8.11.3 => 8.11.4
prisma: ^5.11.0 => 5.11.0
query-string: ^9.0.0 => 9.0.0
redis: ^4.6.13 => 4.6.13
ts-node: ^10.9.2 => 10.9.2
ts-node-dev: ^2.0.0 => 2.0.0
typescript: ^5.4.3 => 5.4.3
uuid: ^9.0.1 => 9.0.1
web3-validator: ^2.0.4 => 2.0.5
xlsx: https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz => 0.20.1
Hello @shadoworion ,
Thank you for the feedback but i couldn't reproduce it. Also there is no mime
dependency related to the @clerk/clerk-sdk-node
so it's kind of weird that this is actually related to that package.
This is a screenshot taken from installing the @clerk/clerk-sdk-node@latest
project and running the tsc
with default typescript settings.
Could you remove and re-install your node_modules and check if that fixes your issue? If the problem persists, could you provide a minimal reproduction repo with the issue?
Hi, @dimkl
The problem is this package "@types/mime@4.0.0" - it's empty.
I see it here, but it may be in more places:
@clerk/clerk-sdk-node > @types/express > @types/serve-static > @types/mime@4.0.0
The problem is resolved if you downgrade to "@types/mime@3.0.4".
Minimal reproduction repo with the issue:
https://github.com/shadoworion/clerk-mime-bug
Quick fix for this issue - add this to package.json:
"resolutions": {
"@types/mime": "3.0.4"
},
This seems to happen because v4 of @types/mime
was marked deprecated and a stub package: https://www.npmjs.com/package/@types/mime/v/4.0.0
While the currently latest version of @clerk/clerk-sdk-node
uses a fixed version of @types/express
in its dependencies, the transient @types/server-static
does not. There's a PR open to fix the types for it: DefinitelyTyped/DefinitelyTyped#69231. They are aware of the issue: DefinitelyTyped/DefinitelyTyped#69213 (comment)
Once that is released it'll be fixed. So it's a temporary issue which you can fix by using resolutions
. Soon you'll be able to use the Core 2 version (https://clerk.com/changelog/2024-02-29-core-2) of the Node SDK which won't have these types in its dependencies at all: https://unpkg.com/browse/@clerk/clerk-sdk-node@5.0.0-beta.33/package.json
Hi, @LekoArts
Do you have an approximate release date of v5 packages?
It's about days/weeks/months?
It should be released in the coming weeks ๐
I also expect the DefinitelyTyped maintainers to release a fix for the issue quickly. Unfortunately that's just sometimes how it goes with many interconnected packages :)
DefinitelyTyped/DefinitelyTyped#69231 is merged and released now, so this is fixed ๐