I'm trying to stream file upload to google cloud storage bucket, through signed url, I'm using "got" to pipe the request, but the request always fails gibing me 403, access denied and signature mismatch.
my code:
save(req: Request, res: Response) {
const gotStream = got.stream.put(signedUrl, {
headers: req.headers,
// for local machine
https: { rejectUnauthorized: false },
});
req.pipe(gotStream);
// Handling response and errors
gotStream.on('data', (response) => {
if (response.statusCode === 200) {
res.json({ success: true });
} else {
res.status(response.statusCode).send('Upload to GCS failed');
}
});
gotStream.on('error', (error) => {
res.status(500).send(error.message); // 'Error during streaming upload'
});
}
although the same request succeed in postman for the asme "signedUrl"
I've tried changing put request and sign the url action as resumable with no luck