spotify-web-api-node icon indicating copy to clipboard operation
spotify-web-api-node copied to clipboard

Include server side auth functions with Webpack (CloudFlare Workers)

Open serban-mihai opened this issue 3 years ago • 0 comments

I'm trying to auth with the Client Credential Flow from a Worker in CloudFlare. Before deploying, the worker goes through Webpack and I guess this is the reason for the exclusion of the serverside functions. If I try to call the clientCredentialsGrant() function i get an exception: clientCredentialsGrant is not a function.

There is a workaround here but when used with Typescript, for this line import SpotifyWebApiServer from 'spotify-web-api-node/src/server-methods'; it return the error:

Could not find a declaration file for module 'spotify-web-api-node/src/server-methods'. '/myProject/node_modules/spotify-web-api-node/src/server-methods.js' implicitly has an 'any' type.

I'm kinda new to Typescript, but is there any way to bypass the exclusion of such methods with webpack the correct way?

serban-mihai avatar Jul 31 '21 10:07 serban-mihai