vapi js server sdk phoneNumbers.update() fails
# support
s
"@User-ai/server-sdk": "^0.4.0" When using the client as: vapiClient.phoneNumbers.update('some-phone-number-id-here', { name: "Dev" }); I get the following error:
Copy code
965 |             var _a;
966 |             // Force clean-up, because some packages (e.g. nock) don't do this.
967 |             request.destroy();
968 |             // Node.js <= 12.18.2 mistakenly emits the response `end` first.
969 |             (_a = request.res) === null || _a === void 0 ? void 0 : _a.removeAllListeners('end');
970 |             error = error instanceof timed_out_1.TimeoutError ? new TimeoutError(error, this.timings, this) : new RequestError(error.message, error, this);
                                                                                                                        ^
RequestError: Unable to connect. Is the computer able to access the url?
However the patch endpoint is working as expected. This started happening yesterday.
c
Hey can you send us the stackblitz link so that we can test it out?
s
the stackblitz? no idea what that is. Here is the code.
Copy code
import { VapiClient } from "@vapi-ai/server-sdk";

const VAPI_PHONE_NUMBER_ID = "phone-number-id-here"
const VAPI_TOKEN = "your token here"

const vapiClient = new VapiClient({ token: VAPI_TOKEN });

await vapiClient.phoneNumbers.update(VAPI_PHONE_NUMBER_ID, {
  server: {
    url: `https://www.example.com/webhooks`,
    secret: "supersecret",
  },
});
If you are not able to replicate the error on your end, then I have no clue.
c
You must provide the full JSON payload used to create the phone number, but ensure that any unnecessary parameters are removed. Once cleaned up, it should work correctly.
25 Views