[Bug]: getOwnedNumbers seems to return string (JSON) and not an object
rrnara opened this issue · 3 comments
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
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
Yea I can confim that is what is happening. The charset is throwing off that switch statement. Working on a fix now
The fix has been released in version 3.12.2
(1.10.2
of the @vonage/server-client
and @vonage/numbers
)