Hi guys I need your help understanding why can I pass cors error on post call with axios to a google cloud url signed for uploading a file?,
Im been on ths for 4 days and already tried everthing trust me!
My bucket cors config is this:
`{
method: [ 'GET', 'POST' ],
origin: [ 'https://www.siasol.net','https://siasol.net', 'http://localhost:4200'],
responseHeader: [ 'content-type'],
}`
My post call looks like that:
`const configPost = {
headers: { "content-type": "multipart/form-data"},
};
await axios.post(pathResult.urlToUpload, file, configPost);`
And the way I generate the signedUrl is like this:
`import { SignedPostPolicyV4Output, Storage } from "@google-cloud/storage";
import { GcsPath } from "./protocol_path";
export async function GenerateSignedPolicy(
uploadPath: GcsPath,
fileType: string
😞 Promise<SignedPostPolicyV4Output> {
const file = uploadPath.getGcsFile();
const expires = Date.now() + 10 * 60 * 1000; // 10 minutes
const options = {
expires,
fields: { "x-goog-meta-test": "data", "content-type": fileType },
};
const [response] = await file.generateSignedPostPolicyV4(options);
return response;
}`
Pay attention! this code works with uploading an img
Why cant I pass cors error - tried everthing including remove the cors config from a bucket, also change the cors config to ['*'] to apply to all, and also tried to change the fields at the generateSignedPostPolicyV4 method,
Help please
tried everthing including remove the cors config from a bucket, also change the cors config to ['*'] to apply to all, and also tried to change the fields at the generateSignedPostPolicyV4 method,
I have experienced a similar issues for months. I have a platform allowing users to upload files.
I generate signed upload URLs in my Express.js. In my React.js client, the files will be uploaded using a PUT request to the signed URL.
It works fine in most of the laptops. However, there are a few users (4-5) reported that they can't upload any files. I have diagnosed the issues with them, checked their Chrome developer tools. The browsers always receive a CORS error when uploading to the signed URL.
This issue is laptop specific, and only affecting a handful of users. I found that most of them are using Windows. (but not a specific Windows version and Chrome version).
Sometimes they can be unblocked when switching to Firebase, sometimes it does not resolve the issue.
I have tried a bunch of fixes but nothing works so far.