Hello,
I am trying to send mp3 file data to my Make.com webhook, in order to then upload it to the OpenAI module to be transcribed via the Whisper model.
I’m sending the data via a ruby script. If I send text to the webhook it works fine, so I am sure that the connection and the script is working. However if I send the actual audio file data, I get a 502 Bad Gateway error from Cloudways. The request never arrives to the make.com scenario.
This is what I get back as a response:
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
What can I do about this? I assume it must be cloudflare protection that Make.com is using. The file I am sending is only 10MB and will never exceed 25MB as that is the OpenAI API limit, so I’m not sure what the problem might be. Thanks for any advice.
The relevant ruby code (if it matters) is as follows:
def send_audio_file_to_make(temp_file, lecture, max_retries = 3)
puts "send_audio_file_to_make"
url = "https://hook.us1.make.com/[redacted]"
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
request = Net::HTTP::Post.new(uri.path)
boundary = "RubyFormBoundary#{rand(1000000)}"
request['Content-Type'] = "multipart/form-data; boundary=#{boundary}"
# Read the file and create the body
post_body = []
post_body << "--#{boundary}\r\n"
post_body << "Content-Disposition: form-data; name=\"audio\"; filename=\"audio.mp3\"\r\n"
post_body << "Content-Type: audio/mpeg\r\n\r\n"
post_body << temp_file.read
post_body << "\r\n--#{boundary}--\r\n"
request.body = post_body.join
retries = 0
begin
# Send the request
response = http.request(request)
Thanks for any help!