We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Versions :
{ "spotify-web-api-node": "^5.0.2", "@types/spotify-web-api-node": "^5.0.7", }
Environment : NestJS (https://docs.nestjs.com/)
NestJS
Code of the Service :
import { Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import SpotifyWebApi from 'spotify-web-api-node'; import { PrismaService } from 'src/prisma.service'; @Injectable() export class OAuthService { public client: SpotifyWebApi; constructor(prismaService: PrismaService, configService: ConfigService) { this.client = new SpotifyWebApi({ clientId: configService.get<string>('SPOTIFY_CLIENT_ID'), clientSecret: configService.get<string>('SPOTIFY_CLIENT_SECRET'), redirectUri: configService.get<string>('SPOTIFY_REDIRECT_URI'), }); } }
Error :
spotify_web_api_node_1.default is not a constructor TypeError: spotify_web_api_node_1.default is not a constructor at new OAuthService (/src/oauth/oauth.service.ts:11:19) at Injector.instantiateClass (/node_modules/@nestjs/core/injector/injector.js:330:19) at callback (/node_modules/@nestjs/core/injector/injector.js:48:41) at Injector.resolveConstructorParams (/node_modules/@nestjs/core/injector/injector.js:122:24) at Injector.loadInstance (/node_modules/@nestjs/core/injector/injector.js:52:9) at Injector.loadProvider (/node_modules/@nestjs/core/injector/injector.js:74:9) at async Promise.all (index 5) at InstanceLoader.createInstancesOfProviders (/node_modules/@nestjs/core/injector/instance-loader.js:44:9) at /node_modules/@nestjs/core/injector/instance-loader.js:29:13 at async Promise.all (index 1)
How to reproduce : Create new service containing SpotifyWebApi and launch the app
The text was updated successfully, but these errors were encountered:
In order to fix it temporarly you can use
"esModuleInterop": true
in your tsconfig.json
tsconfig.json
Sorry, something went wrong.
I fixed this like so: import SpotifyWebApi = require('spotify-web-api-node');
import SpotifyWebApi = require('spotify-web-api-node');
this syntax doesn't even make sense
you either import it with ES6 (import {} from '') or ESM (require())
No branches or pull requests
Versions :
Environment :
NestJS
(https://docs.nestjs.com/)Code of the Service :
Error :
How to reproduce :
Create new service containing SpotifyWebApi and launch the app
The text was updated successfully, but these errors were encountered: