google-cloud-platformtwiliobucket

Error - 11750 ## TwiML response body too large In your response to Twilio's request, the response body is larger than 64 kB


I'm trying to access an audio file which is stored in a GCP bucket from a TwiML template which has the following structure:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
   <Play>https://storage.cloud.google.com/.../.../welcome.wav</Play>
</Response>

When I am logged into my GCP account and I try to access this file from the browser, I have no issues. But, when Twilio tries to access it, the following error occurs:

https://www.twilio.com/docs/api/errors/11750

Also, when I execute the following from the command line:

curl -v https://storage.cloud.google.com/.../.../welcome_en.wav

I get the following HTTP response:

HTTP/2 302 
content-type: application/binary

This doesn't seem to be a permissions issue since when I try to access the same file without GCP authentication, I get a HTTP 403 (Forbidden) error.

How do I successfully access this file, which is in a GCP bucket, from Twilio?


Solution

  • One possibility, is that your content type is wrong. According to this page on Supported Audio File Types, Twilio Play is compatible with:

    MIME type   Description
    audio/mpeg  mpeg layer 3 audio
    audio/wav   wav format audio
    audio/wave  wav format audio
    audio/x-wav wav format audio
    audio/aiff  audio interchange file format
    audio/x-aifc    audio interchange file format
    audio/x-aiff    audio interchange file format
    audio/x-gsm GSM audio format
    audio/gsm   GSM audio format
    audio/ulaw  μ-law audio format
    

    "application/binary" isn't on the list. I play audio files from blob storage and specify the content type for the blob. Are you able to specify a content type for the blob in the GCP bucket?

    You should also check the Twilio Console to find the cause of the "response body too large". It could be that the GPC is returning a login page or an unauthorized error and that is making the Twiml too large for Twilio to process. The Twilio Console should have an error in the error log or open the call that caused the error and view the Twiml.