getSignedURL() in Google Cloud Function produces link that works for several days, then returns “SignatureDoesNotMatch”Get Download URL from file uploaded with Cloud Functions for FirebaseCloud Storage download URLs fail after three days, maybe due to Content-Type?Google Cloud signed Url +SignatureDoesNotMatchissues deleting an image using Cloud Functions for Firebase and @google-cloud/storageGet shorter file URL from Google Cloud Storage (with Firebase Cloud Functions)SignatureDoesNotMatch Google Cloud Storagefirebase / google cloud storage getFiles works fine but .upload or .file do notGoogle Cloud Functions bucket.upload()S3 upload from browser with presigned URL and SSE-C - 307 and 403sRead from Firebase/Google Cloud Storage as a Buffer in Node.js functionGoogle Cloud Cloud Function signed url yields 403 SignatureDoesNotMatchCors Error When Using Google Cloud Storage getSignedUrl Put Axios
Does the Freedom of Movement spell prevent petrification by the Flesh to Stone spell?
What was Captain Marvel supposed to do once she reached her destination?
How many possible file types in the output `ls -l` command?
How do I get my neighbour to stop disturbing with loud music?
Is this statement about a motion being simple harmonic in nature strong?
Why does the U.S. military maintain their own weather satellites?
How did the Altair 8800 front panel load the program counter?
How were US credit cards verified in-store in the 1980's?
In what language did Túrin converse with Mím?
Does the telecom provider need physical access to the SIM card to clone it?
Could a simple hospital oxygen mask protect from aerosol poison?
Can two aircraft be allowed to stay on the same runway at the same time?
My colleague treats me like he's my boss, yet we're on the same level
IList<T> implementation
Can you use Apple Care+ without any checks (bringing just MacBook)?
Necessity of tenure for lifetime academic research
Moscow SVO airport, how to avoid scam taxis without pre-booking?
Divide Numbers by 0
A vector is defined to have a magnitude and *a* direction, but the zero vector has no *single* direction. So, how is the zero vector a vector?
Ask one verbal question to figure out who is blind and who is mute among three persons
Break down the phrase "shitsurei shinakereba naranaindesu"
Could a complex system of reaction wheels be used to propel a spacecraft?
How does the search space affect the speed of an ILP solver?
An idiom for “Until you punish the offender, they will not give up offenses”
getSignedURL() in Google Cloud Function produces link that works for several days, then returns “SignatureDoesNotMatch”
Get Download URL from file uploaded with Cloud Functions for FirebaseCloud Storage download URLs fail after three days, maybe due to Content-Type?Google Cloud signed Url +SignatureDoesNotMatchissues deleting an image using Cloud Functions for Firebase and @google-cloud/storageGet shorter file URL from Google Cloud Storage (with Firebase Cloud Functions)SignatureDoesNotMatch Google Cloud Storagefirebase / google cloud storage getFiles works fine but .upload or .file do notGoogle Cloud Functions bucket.upload()S3 upload from browser with presigned URL and SSE-C - 307 and 403sRead from Firebase/Google Cloud Storage as a Buffer in Node.js functionGoogle Cloud Cloud Function signed url yields 403 SignatureDoesNotMatchCors Error When Using Google Cloud Storage getSignedUrl Put Axios
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
My Firebase Storage getSignedUrl() download links work for a few days, then stop working. The error message is
SignatureDoesNotMatch
The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.
Last summer there was a long discussion of this on GitHub but I don't see that a solution was reached.
I'm thinking of using getDownloadURL() from the front end instead of using getSignedUrl() from the back end. Is getDownloadURL() less secure then getSignedUrl()?
Here's my code, which is mostly copied from the documentation:
let audioType = 'mp3';
const Storage = require('@google-cloud/storage');
const storage = new Storage();
const bucket = storage.bucket('my-app.appspot.com');
var file = bucket.file('Audio/' + longLanguage + '/' + pronunciation + '/' + wordFileType);
// Firebase Storage file options
var options =
metadata:
contentType: 'audio/' + audioType,
metadata:
audioType: audioType,
longAccent: 'United_States',
shortAccent: 'US',
longLanguage: 'English',
shortLanguage: 'en',
source: 'Oxford Dictionaries',
word: word
;
const config =
action: 'read',
expires: '03-17-2025',
content_type: 'audio/mp3'
;
function oedPromise()
return new Promise(function(resolve, reject)
http.get(oedAudioURL, function(response)
response.pipe(file.createWriteStream(options))
.on('error', function(error)
console.error(error);
reject(error);
)
.on('finish', function()
file.getSignedUrl(config, function(err, url)
if (err)
console.error(err);
return;
else
resolve(url)
);
);
);
);
node.js firebase google-cloud-storage firebase-storage
add a comment |
My Firebase Storage getSignedUrl() download links work for a few days, then stop working. The error message is
SignatureDoesNotMatch
The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.
Last summer there was a long discussion of this on GitHub but I don't see that a solution was reached.
I'm thinking of using getDownloadURL() from the front end instead of using getSignedUrl() from the back end. Is getDownloadURL() less secure then getSignedUrl()?
Here's my code, which is mostly copied from the documentation:
let audioType = 'mp3';
const Storage = require('@google-cloud/storage');
const storage = new Storage();
const bucket = storage.bucket('my-app.appspot.com');
var file = bucket.file('Audio/' + longLanguage + '/' + pronunciation + '/' + wordFileType);
// Firebase Storage file options
var options =
metadata:
contentType: 'audio/' + audioType,
metadata:
audioType: audioType,
longAccent: 'United_States',
shortAccent: 'US',
longLanguage: 'English',
shortLanguage: 'en',
source: 'Oxford Dictionaries',
word: word
;
const config =
action: 'read',
expires: '03-17-2025',
content_type: 'audio/mp3'
;
function oedPromise()
return new Promise(function(resolve, reject)
http.get(oedAudioURL, function(response)
response.pipe(file.createWriteStream(options))
.on('error', function(error)
console.error(error);
reject(error);
)
.on('finish', function()
file.getSignedUrl(config, function(err, url)
if (err)
console.error(err);
return;
else
resolve(url)
);
);
);
);
node.js firebase google-cloud-storage firebase-storage
Have you tried using an explicit service account? The bug you link to lists it as a solution.
– Brandon Yarbrough
Mar 28 at 20:26
Yes, I have serviceAccount set to a local json file, and then admin.initializeApp calls the serviceAccount. I call admin.firestore and admin.auth, but I never call admin.storage, as you can see in the above code. Instead I do "const storage = new Storage();", coped from the Google documentation. Maybe I should use admin.storage instead of "new Storage()"? It's not clear to me where "new Storage()" gets a service account from.
– Thomas David Kehoe
Mar 28 at 21:22
OK, I've switched from "const storage = new Storage();" to "const storage = admin.storage();". It works, ask me in a month whether the signed download URLs still work! And this morning I refactored my front end to use getDownloadURL() instead of relying on the back end to provide signed URLs. From reading the discussion on GitHub it sounds like signed URLs were intended for short-term use. The "v4" version can't have an expiration date beyond one week! And Google rotates service keys every week. I prefer signed URLs, as getDownloadURL() added hundreds of lines of complex code to my app.
– Thomas David Kehoe
Mar 28 at 22:09
add a comment |
My Firebase Storage getSignedUrl() download links work for a few days, then stop working. The error message is
SignatureDoesNotMatch
The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.
Last summer there was a long discussion of this on GitHub but I don't see that a solution was reached.
I'm thinking of using getDownloadURL() from the front end instead of using getSignedUrl() from the back end. Is getDownloadURL() less secure then getSignedUrl()?
Here's my code, which is mostly copied from the documentation:
let audioType = 'mp3';
const Storage = require('@google-cloud/storage');
const storage = new Storage();
const bucket = storage.bucket('my-app.appspot.com');
var file = bucket.file('Audio/' + longLanguage + '/' + pronunciation + '/' + wordFileType);
// Firebase Storage file options
var options =
metadata:
contentType: 'audio/' + audioType,
metadata:
audioType: audioType,
longAccent: 'United_States',
shortAccent: 'US',
longLanguage: 'English',
shortLanguage: 'en',
source: 'Oxford Dictionaries',
word: word
;
const config =
action: 'read',
expires: '03-17-2025',
content_type: 'audio/mp3'
;
function oedPromise()
return new Promise(function(resolve, reject)
http.get(oedAudioURL, function(response)
response.pipe(file.createWriteStream(options))
.on('error', function(error)
console.error(error);
reject(error);
)
.on('finish', function()
file.getSignedUrl(config, function(err, url)
if (err)
console.error(err);
return;
else
resolve(url)
);
);
);
);
node.js firebase google-cloud-storage firebase-storage
My Firebase Storage getSignedUrl() download links work for a few days, then stop working. The error message is
SignatureDoesNotMatch
The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.
Last summer there was a long discussion of this on GitHub but I don't see that a solution was reached.
I'm thinking of using getDownloadURL() from the front end instead of using getSignedUrl() from the back end. Is getDownloadURL() less secure then getSignedUrl()?
Here's my code, which is mostly copied from the documentation:
let audioType = 'mp3';
const Storage = require('@google-cloud/storage');
const storage = new Storage();
const bucket = storage.bucket('my-app.appspot.com');
var file = bucket.file('Audio/' + longLanguage + '/' + pronunciation + '/' + wordFileType);
// Firebase Storage file options
var options =
metadata:
contentType: 'audio/' + audioType,
metadata:
audioType: audioType,
longAccent: 'United_States',
shortAccent: 'US',
longLanguage: 'English',
shortLanguage: 'en',
source: 'Oxford Dictionaries',
word: word
;
const config =
action: 'read',
expires: '03-17-2025',
content_type: 'audio/mp3'
;
function oedPromise()
return new Promise(function(resolve, reject)
http.get(oedAudioURL, function(response)
response.pipe(file.createWriteStream(options))
.on('error', function(error)
console.error(error);
reject(error);
)
.on('finish', function()
file.getSignedUrl(config, function(err, url)
if (err)
console.error(err);
return;
else
resolve(url)
);
);
);
);
node.js firebase google-cloud-storage firebase-storage
node.js firebase google-cloud-storage firebase-storage
edited Mar 28 at 12:40
Dennis Alund
1,1301 gold badge5 silver badges19 bronze badges
1,1301 gold badge5 silver badges19 bronze badges
asked Mar 27 at 23:32
Thomas David KehoeThomas David Kehoe
3,0211 gold badge19 silver badges49 bronze badges
3,0211 gold badge19 silver badges49 bronze badges
Have you tried using an explicit service account? The bug you link to lists it as a solution.
– Brandon Yarbrough
Mar 28 at 20:26
Yes, I have serviceAccount set to a local json file, and then admin.initializeApp calls the serviceAccount. I call admin.firestore and admin.auth, but I never call admin.storage, as you can see in the above code. Instead I do "const storage = new Storage();", coped from the Google documentation. Maybe I should use admin.storage instead of "new Storage()"? It's not clear to me where "new Storage()" gets a service account from.
– Thomas David Kehoe
Mar 28 at 21:22
OK, I've switched from "const storage = new Storage();" to "const storage = admin.storage();". It works, ask me in a month whether the signed download URLs still work! And this morning I refactored my front end to use getDownloadURL() instead of relying on the back end to provide signed URLs. From reading the discussion on GitHub it sounds like signed URLs were intended for short-term use. The "v4" version can't have an expiration date beyond one week! And Google rotates service keys every week. I prefer signed URLs, as getDownloadURL() added hundreds of lines of complex code to my app.
– Thomas David Kehoe
Mar 28 at 22:09
add a comment |
Have you tried using an explicit service account? The bug you link to lists it as a solution.
– Brandon Yarbrough
Mar 28 at 20:26
Yes, I have serviceAccount set to a local json file, and then admin.initializeApp calls the serviceAccount. I call admin.firestore and admin.auth, but I never call admin.storage, as you can see in the above code. Instead I do "const storage = new Storage();", coped from the Google documentation. Maybe I should use admin.storage instead of "new Storage()"? It's not clear to me where "new Storage()" gets a service account from.
– Thomas David Kehoe
Mar 28 at 21:22
OK, I've switched from "const storage = new Storage();" to "const storage = admin.storage();". It works, ask me in a month whether the signed download URLs still work! And this morning I refactored my front end to use getDownloadURL() instead of relying on the back end to provide signed URLs. From reading the discussion on GitHub it sounds like signed URLs were intended for short-term use. The "v4" version can't have an expiration date beyond one week! And Google rotates service keys every week. I prefer signed URLs, as getDownloadURL() added hundreds of lines of complex code to my app.
– Thomas David Kehoe
Mar 28 at 22:09
Have you tried using an explicit service account? The bug you link to lists it as a solution.
– Brandon Yarbrough
Mar 28 at 20:26
Have you tried using an explicit service account? The bug you link to lists it as a solution.
– Brandon Yarbrough
Mar 28 at 20:26
Yes, I have serviceAccount set to a local json file, and then admin.initializeApp calls the serviceAccount. I call admin.firestore and admin.auth, but I never call admin.storage, as you can see in the above code. Instead I do "const storage = new Storage();", coped from the Google documentation. Maybe I should use admin.storage instead of "new Storage()"? It's not clear to me where "new Storage()" gets a service account from.
– Thomas David Kehoe
Mar 28 at 21:22
Yes, I have serviceAccount set to a local json file, and then admin.initializeApp calls the serviceAccount. I call admin.firestore and admin.auth, but I never call admin.storage, as you can see in the above code. Instead I do "const storage = new Storage();", coped from the Google documentation. Maybe I should use admin.storage instead of "new Storage()"? It's not clear to me where "new Storage()" gets a service account from.
– Thomas David Kehoe
Mar 28 at 21:22
OK, I've switched from "const storage = new Storage();" to "const storage = admin.storage();". It works, ask me in a month whether the signed download URLs still work! And this morning I refactored my front end to use getDownloadURL() instead of relying on the back end to provide signed URLs. From reading the discussion on GitHub it sounds like signed URLs were intended for short-term use. The "v4" version can't have an expiration date beyond one week! And Google rotates service keys every week. I prefer signed URLs, as getDownloadURL() added hundreds of lines of complex code to my app.
– Thomas David Kehoe
Mar 28 at 22:09
OK, I've switched from "const storage = new Storage();" to "const storage = admin.storage();". It works, ask me in a month whether the signed download URLs still work! And this morning I refactored my front end to use getDownloadURL() instead of relying on the back end to provide signed URLs. From reading the discussion on GitHub it sounds like signed URLs were intended for short-term use. The "v4" version can't have an expiration date beyond one week! And Google rotates service keys every week. I prefer signed URLs, as getDownloadURL() added hundreds of lines of complex code to my app.
– Thomas David Kehoe
Mar 28 at 22:09
add a comment |
2 Answers
2
active
oldest
votes
The maximum duration of a Google Cloud Storage Signed URL is 7 days. But it can also be shorter. Never longer. I guess the Firebase Storage has the same limit.
I hesitate to give you the green check mark because it's not the answer I want, but there's every reason to believe you. The documentation (cloud.google.com/nodejs/docs/reference/storage/2.3.x/…) says that "expires" is "A timestamp when this link will expire," without saying anything about a seven day limit. The documentation examples have "expires: '03-17-2025'", implying that you can set the expiration date years in the future. But not matter what I do the download URLs expire in seven days.
– Thomas David Kehoe
Apr 24 at 16:36
2
Is there any way to get a permanent download URL from a Google Cloud Function? I know how to use getDownloadURL() from the browser, but I can't get it to work in a Cloud Function. getDownloadURL() isn't a Node function. It seems odd to me that I can get a permanent download URL from the browser and a temporary download URL from the Cloud Function. Shouldn't it be the other way around? Browsers are transitory, no one will keep their browser open for a week. But when I upload files from a Cloud Function it's permanent, and the download URL should be permanent,
– Thomas David Kehoe
Apr 24 at 19:04
If you enable public access on your object in Cloud Storage, you can use a direct URL to that object. Everybody with that URL can download the object.
– Peter Fortuin
Apr 30 at 14:45
add a comment |
I've written a long answer to this question: [Get Download URL from file uploaded with Cloud Functions for Firebase. This question can be marked as a duplicate.
[1]: https://stackoverflow.com/questions/42956250/get-download-url-from-file-uploaded-with-cloud-functions-for-firebase
Ten days later the signed download URLs are dead. Problem not solved!
– Thomas David Kehoe
Apr 24 at 16:31
Thomas David Kehoe - did you ever find a solution to this? This problem has been driving me nuts for a very long time.
– barrylachapelle
Jul 3 at 13:02
@barrylachapelle, I wrote a long answer here: stackoverflow.com/questions/42956250/… I'm testing another idea someone suggested (using uuidv2 instead of uuidv4), ask me in a week if this worked!
– Thomas David Kehoe
Jul 8 at 18:04
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388061%2fgetsignedurl-in-google-cloud-function-produces-link-that-works-for-several-day%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The maximum duration of a Google Cloud Storage Signed URL is 7 days. But it can also be shorter. Never longer. I guess the Firebase Storage has the same limit.
I hesitate to give you the green check mark because it's not the answer I want, but there's every reason to believe you. The documentation (cloud.google.com/nodejs/docs/reference/storage/2.3.x/…) says that "expires" is "A timestamp when this link will expire," without saying anything about a seven day limit. The documentation examples have "expires: '03-17-2025'", implying that you can set the expiration date years in the future. But not matter what I do the download URLs expire in seven days.
– Thomas David Kehoe
Apr 24 at 16:36
2
Is there any way to get a permanent download URL from a Google Cloud Function? I know how to use getDownloadURL() from the browser, but I can't get it to work in a Cloud Function. getDownloadURL() isn't a Node function. It seems odd to me that I can get a permanent download URL from the browser and a temporary download URL from the Cloud Function. Shouldn't it be the other way around? Browsers are transitory, no one will keep their browser open for a week. But when I upload files from a Cloud Function it's permanent, and the download URL should be permanent,
– Thomas David Kehoe
Apr 24 at 19:04
If you enable public access on your object in Cloud Storage, you can use a direct URL to that object. Everybody with that URL can download the object.
– Peter Fortuin
Apr 30 at 14:45
add a comment |
The maximum duration of a Google Cloud Storage Signed URL is 7 days. But it can also be shorter. Never longer. I guess the Firebase Storage has the same limit.
I hesitate to give you the green check mark because it's not the answer I want, but there's every reason to believe you. The documentation (cloud.google.com/nodejs/docs/reference/storage/2.3.x/…) says that "expires" is "A timestamp when this link will expire," without saying anything about a seven day limit. The documentation examples have "expires: '03-17-2025'", implying that you can set the expiration date years in the future. But not matter what I do the download URLs expire in seven days.
– Thomas David Kehoe
Apr 24 at 16:36
2
Is there any way to get a permanent download URL from a Google Cloud Function? I know how to use getDownloadURL() from the browser, but I can't get it to work in a Cloud Function. getDownloadURL() isn't a Node function. It seems odd to me that I can get a permanent download URL from the browser and a temporary download URL from the Cloud Function. Shouldn't it be the other way around? Browsers are transitory, no one will keep their browser open for a week. But when I upload files from a Cloud Function it's permanent, and the download URL should be permanent,
– Thomas David Kehoe
Apr 24 at 19:04
If you enable public access on your object in Cloud Storage, you can use a direct URL to that object. Everybody with that URL can download the object.
– Peter Fortuin
Apr 30 at 14:45
add a comment |
The maximum duration of a Google Cloud Storage Signed URL is 7 days. But it can also be shorter. Never longer. I guess the Firebase Storage has the same limit.
The maximum duration of a Google Cloud Storage Signed URL is 7 days. But it can also be shorter. Never longer. I guess the Firebase Storage has the same limit.
answered Apr 7 at 20:22
Peter FortuinPeter Fortuin
2,1316 gold badges30 silver badges60 bronze badges
2,1316 gold badges30 silver badges60 bronze badges
I hesitate to give you the green check mark because it's not the answer I want, but there's every reason to believe you. The documentation (cloud.google.com/nodejs/docs/reference/storage/2.3.x/…) says that "expires" is "A timestamp when this link will expire," without saying anything about a seven day limit. The documentation examples have "expires: '03-17-2025'", implying that you can set the expiration date years in the future. But not matter what I do the download URLs expire in seven days.
– Thomas David Kehoe
Apr 24 at 16:36
2
Is there any way to get a permanent download URL from a Google Cloud Function? I know how to use getDownloadURL() from the browser, but I can't get it to work in a Cloud Function. getDownloadURL() isn't a Node function. It seems odd to me that I can get a permanent download URL from the browser and a temporary download URL from the Cloud Function. Shouldn't it be the other way around? Browsers are transitory, no one will keep their browser open for a week. But when I upload files from a Cloud Function it's permanent, and the download URL should be permanent,
– Thomas David Kehoe
Apr 24 at 19:04
If you enable public access on your object in Cloud Storage, you can use a direct URL to that object. Everybody with that URL can download the object.
– Peter Fortuin
Apr 30 at 14:45
add a comment |
I hesitate to give you the green check mark because it's not the answer I want, but there's every reason to believe you. The documentation (cloud.google.com/nodejs/docs/reference/storage/2.3.x/…) says that "expires" is "A timestamp when this link will expire," without saying anything about a seven day limit. The documentation examples have "expires: '03-17-2025'", implying that you can set the expiration date years in the future. But not matter what I do the download URLs expire in seven days.
– Thomas David Kehoe
Apr 24 at 16:36
2
Is there any way to get a permanent download URL from a Google Cloud Function? I know how to use getDownloadURL() from the browser, but I can't get it to work in a Cloud Function. getDownloadURL() isn't a Node function. It seems odd to me that I can get a permanent download URL from the browser and a temporary download URL from the Cloud Function. Shouldn't it be the other way around? Browsers are transitory, no one will keep their browser open for a week. But when I upload files from a Cloud Function it's permanent, and the download URL should be permanent,
– Thomas David Kehoe
Apr 24 at 19:04
If you enable public access on your object in Cloud Storage, you can use a direct URL to that object. Everybody with that URL can download the object.
– Peter Fortuin
Apr 30 at 14:45
I hesitate to give you the green check mark because it's not the answer I want, but there's every reason to believe you. The documentation (cloud.google.com/nodejs/docs/reference/storage/2.3.x/…) says that "expires" is "A timestamp when this link will expire," without saying anything about a seven day limit. The documentation examples have "expires: '03-17-2025'", implying that you can set the expiration date years in the future. But not matter what I do the download URLs expire in seven days.
– Thomas David Kehoe
Apr 24 at 16:36
I hesitate to give you the green check mark because it's not the answer I want, but there's every reason to believe you. The documentation (cloud.google.com/nodejs/docs/reference/storage/2.3.x/…) says that "expires" is "A timestamp when this link will expire," without saying anything about a seven day limit. The documentation examples have "expires: '03-17-2025'", implying that you can set the expiration date years in the future. But not matter what I do the download URLs expire in seven days.
– Thomas David Kehoe
Apr 24 at 16:36
2
2
Is there any way to get a permanent download URL from a Google Cloud Function? I know how to use getDownloadURL() from the browser, but I can't get it to work in a Cloud Function. getDownloadURL() isn't a Node function. It seems odd to me that I can get a permanent download URL from the browser and a temporary download URL from the Cloud Function. Shouldn't it be the other way around? Browsers are transitory, no one will keep their browser open for a week. But when I upload files from a Cloud Function it's permanent, and the download URL should be permanent,
– Thomas David Kehoe
Apr 24 at 19:04
Is there any way to get a permanent download URL from a Google Cloud Function? I know how to use getDownloadURL() from the browser, but I can't get it to work in a Cloud Function. getDownloadURL() isn't a Node function. It seems odd to me that I can get a permanent download URL from the browser and a temporary download URL from the Cloud Function. Shouldn't it be the other way around? Browsers are transitory, no one will keep their browser open for a week. But when I upload files from a Cloud Function it's permanent, and the download URL should be permanent,
– Thomas David Kehoe
Apr 24 at 19:04
If you enable public access on your object in Cloud Storage, you can use a direct URL to that object. Everybody with that URL can download the object.
– Peter Fortuin
Apr 30 at 14:45
If you enable public access on your object in Cloud Storage, you can use a direct URL to that object. Everybody with that URL can download the object.
– Peter Fortuin
Apr 30 at 14:45
add a comment |
I've written a long answer to this question: [Get Download URL from file uploaded with Cloud Functions for Firebase. This question can be marked as a duplicate.
[1]: https://stackoverflow.com/questions/42956250/get-download-url-from-file-uploaded-with-cloud-functions-for-firebase
Ten days later the signed download URLs are dead. Problem not solved!
– Thomas David Kehoe
Apr 24 at 16:31
Thomas David Kehoe - did you ever find a solution to this? This problem has been driving me nuts for a very long time.
– barrylachapelle
Jul 3 at 13:02
@barrylachapelle, I wrote a long answer here: stackoverflow.com/questions/42956250/… I'm testing another idea someone suggested (using uuidv2 instead of uuidv4), ask me in a week if this worked!
– Thomas David Kehoe
Jul 8 at 18:04
add a comment |
I've written a long answer to this question: [Get Download URL from file uploaded with Cloud Functions for Firebase. This question can be marked as a duplicate.
[1]: https://stackoverflow.com/questions/42956250/get-download-url-from-file-uploaded-with-cloud-functions-for-firebase
Ten days later the signed download URLs are dead. Problem not solved!
– Thomas David Kehoe
Apr 24 at 16:31
Thomas David Kehoe - did you ever find a solution to this? This problem has been driving me nuts for a very long time.
– barrylachapelle
Jul 3 at 13:02
@barrylachapelle, I wrote a long answer here: stackoverflow.com/questions/42956250/… I'm testing another idea someone suggested (using uuidv2 instead of uuidv4), ask me in a week if this worked!
– Thomas David Kehoe
Jul 8 at 18:04
add a comment |
I've written a long answer to this question: [Get Download URL from file uploaded with Cloud Functions for Firebase. This question can be marked as a duplicate.
[1]: https://stackoverflow.com/questions/42956250/get-download-url-from-file-uploaded-with-cloud-functions-for-firebase
I've written a long answer to this question: [Get Download URL from file uploaded with Cloud Functions for Firebase. This question can be marked as a duplicate.
[1]: https://stackoverflow.com/questions/42956250/get-download-url-from-file-uploaded-with-cloud-functions-for-firebase
edited Jul 8 at 18:07
answered Apr 13 at 1:16
Thomas David KehoeThomas David Kehoe
3,0211 gold badge19 silver badges49 bronze badges
3,0211 gold badge19 silver badges49 bronze badges
Ten days later the signed download URLs are dead. Problem not solved!
– Thomas David Kehoe
Apr 24 at 16:31
Thomas David Kehoe - did you ever find a solution to this? This problem has been driving me nuts for a very long time.
– barrylachapelle
Jul 3 at 13:02
@barrylachapelle, I wrote a long answer here: stackoverflow.com/questions/42956250/… I'm testing another idea someone suggested (using uuidv2 instead of uuidv4), ask me in a week if this worked!
– Thomas David Kehoe
Jul 8 at 18:04
add a comment |
Ten days later the signed download URLs are dead. Problem not solved!
– Thomas David Kehoe
Apr 24 at 16:31
Thomas David Kehoe - did you ever find a solution to this? This problem has been driving me nuts for a very long time.
– barrylachapelle
Jul 3 at 13:02
@barrylachapelle, I wrote a long answer here: stackoverflow.com/questions/42956250/… I'm testing another idea someone suggested (using uuidv2 instead of uuidv4), ask me in a week if this worked!
– Thomas David Kehoe
Jul 8 at 18:04
Ten days later the signed download URLs are dead. Problem not solved!
– Thomas David Kehoe
Apr 24 at 16:31
Ten days later the signed download URLs are dead. Problem not solved!
– Thomas David Kehoe
Apr 24 at 16:31
Thomas David Kehoe - did you ever find a solution to this? This problem has been driving me nuts for a very long time.
– barrylachapelle
Jul 3 at 13:02
Thomas David Kehoe - did you ever find a solution to this? This problem has been driving me nuts for a very long time.
– barrylachapelle
Jul 3 at 13:02
@barrylachapelle, I wrote a long answer here: stackoverflow.com/questions/42956250/… I'm testing another idea someone suggested (using uuidv2 instead of uuidv4), ask me in a week if this worked!
– Thomas David Kehoe
Jul 8 at 18:04
@barrylachapelle, I wrote a long answer here: stackoverflow.com/questions/42956250/… I'm testing another idea someone suggested (using uuidv2 instead of uuidv4), ask me in a week if this worked!
– Thomas David Kehoe
Jul 8 at 18:04
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388061%2fgetsignedurl-in-google-cloud-function-produces-link-that-works-for-several-day%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried using an explicit service account? The bug you link to lists it as a solution.
– Brandon Yarbrough
Mar 28 at 20:26
Yes, I have serviceAccount set to a local json file, and then admin.initializeApp calls the serviceAccount. I call admin.firestore and admin.auth, but I never call admin.storage, as you can see in the above code. Instead I do "const storage = new Storage();", coped from the Google documentation. Maybe I should use admin.storage instead of "new Storage()"? It's not clear to me where "new Storage()" gets a service account from.
– Thomas David Kehoe
Mar 28 at 21:22
OK, I've switched from "const storage = new Storage();" to "const storage = admin.storage();". It works, ask me in a month whether the signed download URLs still work! And this morning I refactored my front end to use getDownloadURL() instead of relying on the back end to provide signed URLs. From reading the discussion on GitHub it sounds like signed URLs were intended for short-term use. The "v4" version can't have an expiration date beyond one week! And Google rotates service keys every week. I prefer signed URLs, as getDownloadURL() added hundreds of lines of complex code to my app.
– Thomas David Kehoe
Mar 28 at 22:09