amplify-js: Amplify v6: It is not possible to set boundaries in REST requests with multipart
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React
Amplify APIs
REST API
Amplify Categories
api
Environment information
# Put output below this line
"dependencies": {
...,
"@aws-amplify/api-rest": "^4.0.5",
"@aws-amplify/auth": "^6.0.5",
"@aws-amplify/ui-react": "^6.0.3",
},
Describe the bug
When i try to submit a Rest request that contains Multipart the framework sets Content-Type to multipart/form-data and it prevents the creatorin of boundary
Content-Type: multipart/form-data; boundary=---------------------------3513053024223207799458523308
This is a change compared to the v.5.X version.
Am i missing something? Is there any documentation about this change?
Expected behavior
Implement the same behavior that we had with the previous version
Reproduction steps
const form = new FormData(); form.append(parameterName, new Blob([file], { type: file.type }), file.name); post({ apiName, path, options: { body: form } }).response.body.json();
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Reactions: 3
- Comments: 15 (7 by maintainers)
Hi @AllanZhengYP
I can confirm the same as @dvalbuena1
Best
Hi @AllanZhengYP I just tested
6.0.8and6.0.9-unstable.58ed2f7.0and the6.0.9version worked! It is setting theboundarycorrectly.6.0.8version did not.In the meantime, it is save to use that
6.0.9version, right?HI @svidgen
With the following configuration, this was working
After the following upgrade, it is not possible to upload files with REST API
Authentication is against AWS Cognito
Best
Same issue here. When trying to upload a file via API REST, looks like V6 is not setting the boundary as mentioned by @kingferiol
In fact, when comparing the requests through Dev tools the boundary is missing in V6: V5:
V6: