bitmovin-api-sdk-javascript icon indicating copy to clipboard operation
bitmovin-api-sdk-javascript copied to clipboard

Running into 'BitmovinApi is not a constructor' error

Open internetdrew opened this issue 2 years ago • 0 comments

This might be only if using es6 modules since I see reference to 'default' in the require() flow.

With require instructions: const BitmovinApi = require('@bitmovin/api-sdk')["default"];

es6 import instructions currently: import BitmovinApi from '@bitmovin/api-sdk';

Documentation shows the following to create a new instance of the BitmovinApi:

const bitmovinApi = new BitmovinApi({
  apiKey: 'API_KEY',
});

But on further inspection, there is a method on the BitmovinApi object itself called 'default' that actually returns the constructor function.

So to create a new instance successfully you must:

const bitmovinApi = new BitmovinApi.default({
  apiKey: 'API_KEY',
});

internetdrew avatar Jan 03 '23 17:01 internetdrew