image-url
image-url copied to clipboard
Nest.js usage results in TypeError: (0 , image_url_1.default) is not a function
If you find a security vulnerability, do NOT open an issue. Email [email protected] instead.
Describe the bug
Usage in Nest.js with pnpm results in error:
[Nest] 4705 - 10/10/2023, 11:29:34 PM ERROR [ExceptionsHandler] (0 , image_url_1.default) is not a function
TypeError: (0 , image_url_1.default) is not a function
at AppService.getHello (/Users/stephen/dev/sanity-image-url-bug/src/app.service.ts:13:27)
at AppController.getHello (/Users/stephen/dev/sanity-image-url-bug/src/app.controller.ts:10:28)
at /Users/stephen/dev/sanity-image-url-bug/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@nestjs/core/router/router-execution-context.js:38:29
at InterceptorsConsumer.intercept (/Users/stephen/dev/sanity-image-url-bug/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@nestjs/core/interceptors/interceptors-consumer.js:12:20)
at /Users/stephen/dev/sanity-image-url-bug/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@nestjs/core/router/router-execution-context.js:46:60
at /Users/stephen/dev/sanity-image-url-bug/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@nestjs/core/router/router-proxy.js:9:23
at Layer.handle [as handle_request] (/Users/stephen/dev/sanity-image-url-bug/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/stephen/dev/sanity-image-url-bug/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/route.js:144:13)
at Route.dispatch (/Users/stephen/dev/sanity-image-url-bug/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/route.js:114:3)
at Layer.handle [as handle_request] (/Users/stephen/dev/sanity-image-url-bug/node_modules/.pnpm/[email protected]/node_modules/express/lib/router/layer.js:95:5)
To Reproduce
Steps to reproduce the behavior:
Reproducable in this repo of a new Nest.js project: https://github.com/stephenhmarsh/sanity-image-url-bug
- clone
- pnpm install
- pnpm start
- navigate to
/of the server (localhost:3000)
Expected behavior
The default export of the package should be a function that works.
Screenshots If applicable, add screenshots to help explain your problem.
Which versions of Sanity are you using?
@sanity/cli (global) 3.15.1 (latest: 3.18.0)
@sanity/image-url 1.0.2 (up to date)
What operating system are you using?
MacOS Sonoma 14.0 (23A344)
Which versions of Node.js / npm are you running?
Run npm -v && node -v in the terminal and copy-paste the result here.
Using pnpm
pnpm -v && node -v
8.9.0
v18.14.0
Additional context
Add any other context about the problem here.
Security issue?
Any security issues should be submitted directly to [email protected]. In order to determine whether you are dealing with a security issue, ask yourself these two questions:
- Can I access something that's not mine, or something I shouldn't have access to?
- Can I disable something for other people? If the answer to either of those two questions are "yes", then you're probably dealing with a security issue. Note that even if you answer "no" to both questions, you may still be dealing with a security issue, so if you're unsure, just email us at [[email protected]](mailto:[email protected].