我正在上传一个base64字符串,但GraphQL被挂起了.如果我将字符串切片少于50,000个字符就可以了.在50,000个字符之后,graphQL永远不会使其成为解析函数,但不会产生错误.在较小的字符串上,它工作得很好.
const file = e.target.files[0];
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onloadend = () => {
const imageArray = reader.result;
this.context.fetch('/graphql', {
body: JSON.stringify({
query: `mutation s3Upload($img: String!) {
s3Upload(file: $img) {
logo,
}
}`,
variables: {
img: imageArray,
},
}),
}).then(response => response.json())
.then(({ data }) => {
console.log(data);
});
}
const s3Upload = {
type: S3Type,
args: {
file: { type: new NonNull(StringType) },
},
resolve: (root, args, { user }) => upload(root, args, user),
};
const S3Type …
Run Code Online (Sandbox Code Playgroud)