benjreinhart / react-native-aws3

Pure JavaScript React Native library for uploading to AWS S3
MIT License
399 stars 151 forks source link

412 Precondition Failed #26

Open mxmtsk opened 7 years ago

mxmtsk commented 7 years ago

I'm getting the following error when trying to upload an image:

<Error>
<Code>PreconditionFailed</Code>
<Message>At least one of the pre-conditions you specified did not hold</Message>
<Condition>Bucket POST must be of the enclosure-type multipart/form-data</Condition>
<RequestId>A05CC8899FE783C8</RequestId>
<HostId>RNTOTXJEJtXOa3FMgyEtcKcqV3+YGedEQxUImG1PQijkPeDUeb8PgIz9D1abVmZ3fCvoIS/u8ZQ=</HostId>
</Error>

This is the file:

{uri: "file:///Users/maxmitschke/Library/Developer/CoreSi…p-picker/0411EB1E-D944-4BAD-8BCB-6916CF3D71CC.jpg", type: "image/jpeg", name: "51f76932-ad1d-4ed7-9f19-b11227a6a031.jpg"}

If tried without file:// to, but got the same result.

This is the request that was sent:

Accept:*/*
Accept-Encoding:gzip, deflate
Accept-Language:de
Connection:keep-alive
Content-Length:15
Content-Type:text/plain;charset=UTF-8
Host:my-bucket.s3.amazonaws.com
Origin:null
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) ReactNativeDebugger/0.5.5 Chrome/53.0.2785.143 Electron/1.4.10 Safari/537.36
MayoudP commented 4 years ago

Got the same after getting a pre-signed UR, and failing to upload it then on S3...