Skip to content
New issue

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

[Bug]: getOwnedNumbers seems to return string (JSON) and not an object #903

Closed
rrnara opened this issue Jan 17, 2024 · 3 comments
Closed
Assignees
Labels
bug A defect in the code Triage Issue needs to be triaged

Comments

@rrnara
Copy link

rrnara commented Jan 17, 2024

Node Version

18.x

Platform

Mac (Apple Silcon)

SDK Version

3.12.1

Code Sample

const auth = new Auth({
apiKey: process.env.VONAGE_API_KEY,
apiSecret: process.env.VONAGE_API_SECRET
})
const vonage = new Vonage(auth)
const numbersResp = await vonage.numbers.getOwnedNumbers()
console.log('type', typeof numbersResp)

Expected Behavior

type is object

Actual Behavior

type is string

@rrnara rrnara added bug A defect in the code Triage Issue needs to be triaged labels Jan 17, 2024
@imaustink
Copy link

I started seeing this today as well. Yesterday evening it was working fine for me and my team.

It looks like a small change was made to the Phone Numbers APIs and they now return Content-Type: application/json;charset=UTF-8 and the SDK is explicitly expecting application/json: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/server-client/lib/client.ts#L379

@manchuck
Copy link
Contributor

Yea I can confim that is what is happening. The charset is throwing off that switch statement. Working on a fix now

@manchuck
Copy link
Contributor

The fix has been released in version 3.12.2 (1.10.2 of the @vonage/server-client and @vonage/numbers)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A defect in the code Triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

5 participants