Hi!
I have a set of ~140 MP4s on google cloud storage that I need to get uploaded into Contentful. I have tried two approaches to doing so. These files are approx 50mb.
First approach using createUpload:
- I get a filestream from the google bucket using
@google-cloud/storage
. - Send this as the
file
parameter on createUpload.
In this case I get:
[warning] Connection error occurred. Waiting for 1941 ms before retrying...
[warning] Connection error occurred. Waiting for 2669 ms before retrying...
[warning] Connection error occurred. Waiting for 3520 ms before retrying...
Running this with DEBUG=*
I see it is trying to send the following request:
protocol: 'https:',
hostname: 'upload.contentful.com',
port: '443',
path: '/spaces/<spaceid>/uploads',
method: 'post'
I don’t see any other details for what is occurring, what network response is coming back, etc.
Second approach using createAsset:
- Get a signed URL using google storage API
- Send the signed URL as the
file['en-US'].upload
property on createAsset. - Publish the asset.
The signed URLs work fine with cURL. When the code tries to publish the asset at:
PUT https://api.contentful.com:443/spaces/<spaceid>/environments/master/assets/<assetid>/published
I get a 422: Unprocessable Entity error:
{
"name": "noFileFields",
"details": "The asset has no files"
}
If I try to now manually upload the file via the interface, by using the signed URL in the link, I get an upload error (no details). When I look at the network tab I see that there’s a GET request being made, 400 response, with this body:
validation error: task not found: "videos"
Is this a validation that someone on our side set up, or is it internal at Contentful? I don’t see a place where we can create/edit validations on media assets.
I’ve spent about 6 hours trying these different approaches. Can someone point me in the right direction? I prefer the createAsset
approach because it doesn’t require me to soak up a bunch of bandwidth on my my personal connection downloading and uploading video files. But I think I need:
- Some way of polling the asset status for completion or error
- Resolution/more details on the upload errors that are occuring
Appreciate your time and thoughtfulness. Thanks!