ringcentral/ringcentral-js

Error initializing the SDK class in React

Closed this issue · 2 comments

Hi everybody,

I'm developing a React + Typescript app that uses the RingCentral API. My current task is to listen for new messages in a specific conversation. I found a tutorial to do so by using the Rincentral SDK and then creating a subcription object that listens for a specific type of event. But then I notice that tutorial was using Node.js, so I searched a little bit more and found this tutorial to setup the SDK in a React app.

The problem is, when I try to initialize the RingCentral SDK class that comes from @ringcentral/sdk, I get an unexpected error and I can't see a way to fixed it. Here is the error:

Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')

When I click in the link that shows me which line of code is resulting in an error, it shows me this:

var streamDestructionSupported = "destroy" in import_stream.default.Readable.prototype;

I'm really stuck and don't know where to go from here.

For context purposes I'll show how I'm trying to create my SDK object:

// lib/ringCentralSdk.ts
import { SDK } from '@ringcentral/sdk';

export const rcSdk = new SDK({
  appName: 'Test App',
  appVersion: '1.0.0',
  server: 'https://platform.ringcentral.com',
  clientId: 'MY_CLIENT_SECRET',
  redirectUri: 'http://localhost:3000',
});

Note: I have also installed the @ringcentral/react library in my project, as shown in this tutorial.

Can anybody spot any mistakes that I may have done here? Or is this a problem with the library it self?

Thanks in advance.

Hi, @eduardo-wrkt can you share the whole error stack that would be helpful for debugging?

I'm closing this issue because of inactivity, please reopen it if the problem continues.