Twilio API call failing in production

I’m having a problem where I use the Twilio Node.js to send a text message. After creating the Twilio client object and passing in my credentials, I make a call to client.messages.create() to send the SMS. This works perfectly fine in my local environment, but fails in production with no errors.

Here’s what I know:

  1. It’s not a problem with access to environment variables since I’ve temporarily hardcoded in my tokens.
  2. When I enable debug level logging of the Twilio client, on my local machine it logs both a request and response (and of course the SMS is sent successfully).
  3. In the Netlify function logs, it does log the request, but not a response. There is no error caught.

Hey there, @sudoshuff

Thanks for reaching out, and welcome to the Netlify Forums :netliconfetti: I have a few questions that will help us look into this further for you :slight_smile:

  • In your response, can you share your site name and function name with us?
  • Have you added console log lines to different parts of the function? If so, where are you seeing the last line of the console log printed?