I have tried to find the solution from github issues and stackoverflow but I can't find the same problem.
so, I need to create the download URL using Node JS, cloud function and admin sdk. I create the download URL using the code below following the answer from here
const defaultBucket = admin.storage().bucket("xxxx.appspot.com");
// get poster URL
const posterFile = defaultBucket.file(`eventPoster/${creatorID}/${eventID}`);
const posterSignedURLs = await posterFile.getSignedUrl({
action: "read",
expires: "03-09-2491",
});
const posterURL = posterSignedURLs[0];
I can successfully create the download URL using the code above, if copy and paste created download URL in chrome browser, I can see the image in the chrome browser.
but it seems to me that the download URL no longer work after sometime, for event Poster image that has been created (maybe) more than 7 days ago, then I can't see the image in the browser and I will have xml error in the browser like this
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.</Message>
<StringToSign>GET 16447017600 /xxxxx.appspot.com/eventPoster/2uP61xZrZXaAKh2CGKtMTPbxSI73/cb36a4b5-fe5d-4deb-a6ab-e64594b743d0</StringToSign>
</Error>
I can only see the image that I just create. it seems to me the image download URL is invalid after sometime. how to solve this? can I add the duration for at least 3 months?