S3 upload function does not return files keys
Twathik opened this issue · 3 comments
wunderctl version : 0.60.2
@wundergraph/sdk: "^0.75",
OS: mac os 11 big sir
node v : 17
I have removed the fileConfig method check so I can try the S3 upload function (otherwise the function does not work due to an error in the generated client already reported in https://github.com/wundergraph/nextjs-typescript-postgresql-graphql-realtime-chat/issues/1#issue-1133968792)
I have managed to upload the file to local minio instance but the response returns an empty object
{
"status": "ok",
"body": {}
}
the files keys are not returned from the upload function
I have used a simple implementation
const {
client: { uploadFiles, },
} = useWunderGraph();
const [files, setFiles] = useState<FileList>();
const [data, setData] = useState<UploadResponse[]>([]);
const onFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
if (e.target.files) setFiles(e.target.files);
};
const onSubmit = async (e: React.FormEvent<Element>): Promise<void> => {
e.preventDefault();
const formData = new FormData();
if (!files) return;
for (const key in Object.keys(files)) {
formData.append('files', files[key]);
}
formData.append('files', files[0]);
const result = await uploadFiles({ provider: S3Provider.minio, formData });
if (result.status === 'ok') {
console.log({ result: JSON.stringify(result) });
setData(result.body);
}
};
I have checked the minio instance and the files were successfully uploaded
Version 0.76 fixed the error in the generated client, but the response still don't return the uploaded files keys
Awesome thank you!!!