Hello Make Community,
I’ve been enjoying Make so far and find it very intuitive and easy to use. However, I’m currently stumped trying to upload an audio file to an AWS S3 Bucket that is not owned by me. I have received a signed upload URL from the service I am using, Cyanite, and am trying to follow the “Uploading the file” instructions on this documentation page.
That page shows an example using Fetch in Node.js:
import fetch from "node-fetch";
const uploadUrl =
"https://s3.eu-central-1.amazonaws.com/cyanite-file-storage/1/a64ea798-3490-4b42-9917-2c63307d747d?Content-Type=audio%2Fmpeg&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJEAGRZG3TDV5AMHQ%2F20210204%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20210204T132927Z&X-Amz-Expires=900&X-Amz-Signature=8d8e8b8029dc2710e1ca27be1ef9094801e4e8bd7c0c313ac40da30a56330558&X-Amz-SignedHeaders=host";
const fileName = "frog.mp3";
async function main() {
const result = await fetch(uploadUrl, {
method: "PUT",
body: fs.createReadStream(fileName),
headers: {
"Content-Type": "audio/mpeg",
},
}).then((res) => res.text());
console.log(result);
}
main();
I have been trying to replicate this in an HTTP ‘Make a request’ module without any luck. As you can see from the grab below, I have a ‘Download a File’ Module which has successfully grabbed the file from Airtable. I assume the problem must be the way I am mapping things - I have tried multiple combinations of different body types but nothing seems to work.
Any pointers are greatly appreciated!
Barnaby
Hey @Barnaby_Marshall, glad to hear you’re enjoying using Make!
Are you getting any error message from the Make a request
module?
2 Likes
Thanks for getting back to me David.
No errors, but the size of the file upload is shown as zero. Below is a screen grab.
I’m wondering if the Cyanite node.js instructions are correct … the Curl example they give will be sending the data with a Content-Type
of multipart/form-data
rather than audio/mpeg
.
I see that audio/mpeg is also passed in the query string part of the supplied URL.
Maybe try the Make a request
module with Body type
of multipart/form-data
?
2 Likes
OK, I tried that, but still got the “Success” message but with the same zero size for the upload. Below is a grab of the module config in Make. I’ve tried various values for the “Key” field but am unsure what should go in there?
Not sure if you have any further thoughts David. I’ve gone back to the Raw Custom upload and passing in the binary data, which I can see when I inspect the Operation values. When I test the scenario and watch its progress, I notice that the failure seems to happen on the upload step: I see the start of the circular progress bar for a split second, but then the process instantly completes, which does not make sense for a 6 MB file. The Cyanite API is returning success as you can see, but the request’s content data is not making it to AWS S3. Can you think of a reason that the http request module is not able to properly process/pass the binary data?
Dumb question … you’re sure the upload URL is valid? Are you able to check it using Curl?
2 Likes
I’m also wondering if the Content-Length
header also needs to be set in this case …
2 Likes
Good suggestion, here is what I get back from Curl, seems like there are some commands not found, and something about multiuse not being supported. 403 Forbidden at the end. Does this shed any light? Should I follow up with Cyanite?
Those errors are from the bash
command line as it’s interpreting the URL string and breaking at the & characters.
I’d try again with the entire URL string wrapped in quotes.
2 Likes
OK, now we are getting a similar result to Make, success but and a content length of zero. I see the message “We are completely uploaded and fine”.
I think the Content-Length that’s returned in the output relates to the size of the HTTP response rather than confirming the size of the upload (though it doesn’t match the actual output, which isn’t helpful!). It does looks like it’s succeeding.
Have you tried continuing with the next step and creating the library track in Cyanite?
2 Likes
You are exactly right Dave, the return Content-Length has nothing to do with the file payload size. And yes, creating the Library track now works! Thank you very much for your patience in helping me troubleshoot this, it is greatly appreciated.
Barnaby
4 Likes