backpack1098B
Convex Communityβ€’3y agoβ€’
4 replies
backpack1098

long shot: debugging twilio API errors but cannot see logs

hi all! this is a long shot, but i'll try my luck. im trying to debug why my outbound call is successful only once out of the 10 times i try. i've added some log statements around the function but they dont show up in my convex dashboard logs. does anyone know why?

im aware that this is using a node sdk and have add the "use node" pragma.

it succeeded once miraculously. i am interested in getting more logs before i reach out to twilio's support.
export const outbound = action({
  handler: async (ctx) => {
    try {
      const username = process.env.TWILIO_SID!
      console.log("πŸš€ ~ file: say.ts:19 ~ handler: ~ username:", username) // has logs here

      const password = process.env.TWILIO_AUTH_TOKEN!
      const client = new twilio.Twilio(username, password, {
        logLevel: "debug",
      })

      // no more logs starting here
      client.calls
        .create(
          {
            url: "http://demo.twilio.com/docs/voice.xml",
            to: process.env.TO_MY_PHONE!,
            from: process.env.FROM_TWILIO_PHONE!,
          },
          function (err, call) {
            if (err) {
              console.log("πŸš€ ~ file: say.ts:32 ~ handler: ~ err:", err)
            } else {
              console.log("πŸš€ ~ file: say.ts:32 ~ handler: ~ call:", call?.sid)
            }
          }
        )
        .then((call) => {
          console.log(call.sid)
        })
        .catch((err) => {
          console.log("πŸš€ ~ file: say.ts:32 ~ handler: ~ err:", err)
        })
    } catch (e) {
      console.error(e)
      throw e
    }
  },
})

thanks!
Was this page helpful?