You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reposting this issue from firebase-functions firebase/firebase-functions#1547 as it seems to be an issue with the storage emulator rather than the functions SDK. Feel free to close and correct me if i'm mistaken here.
import{initializeApp}from"firebase-admin/app";import{getDownloadURL,getStorage}from"firebase-admin/storage";import{onRequest}from"firebase-functions/v2/https";initializeApp();exportconstuploadFile=onRequest(async(_req,res)=>{// Create a CSV stringconstcsvData="Name,Email,Balance";// Create a new file in the bucketconstbucket=getStorage().bucket();constfile=bucket.file("csvs/temp.csv");// Write the csv data to the fileawaitfile.save(csvData,{metadata: {contentType: "text/csv",},});// Get the download urlconstdownloadUrl=awaitgetDownloadURL(file);res.send(`Download URL: ${downloadUrl}`);});
With rules:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if false;
}
}
}
[REQUIRED] Steps to reproduce
Create a new firebase cloud functions project with typescript and storage emulator
Copy the above provided sample codes in functions/src/index.ts and storage.rules respectively.
Run firebase emulators:start
Send request to the uploadFile function using postman or whatever
See error / crash
Now update storage.rules to allow all paths (i.e. allow read, write: if true;)
Repeat step 4
See a download url is sent
[REQUIRED] Expected behavior
As cloud functions don't rely on and basically bypass the firestore.rules, database.rules and storage.rules, a download url should be fetched no matter what the storage.rules are set to.
[REQUIRED] Actual behavior
functions: Error: Permission denied. No READ permission.
The text was updated successfully, but these errors were encountered:
Thanks for the detailed report @cabljac! Looking though the information provided, I think this is a similar issue to #7946. That said, I'm going to go ahead and close this as a duplicate, but please let me know if you think this is different issue and needs to be reopened.
Reposting this issue from firebase-functions firebase/firebase-functions#1547 as it seems to be an issue with the storage emulator rather than the functions SDK. Feel free to close and correct me if i'm mistaken here.
[REQUIRED] Environment info
firebase-tools: firebase-tools: 13.3.1
node: v20.10.0
firebase-admin: 12.0.0
[REQUIRED] Test case
index.ts
With rules:
[REQUIRED] Steps to reproduce
[REQUIRED] Expected behavior
As cloud functions don't rely on and basically bypass the
firestore.rules
,database.rules
andstorage.rules
, a download url should be fetched no matter what the storage.rules are set to.[REQUIRED] Actual behavior
functions: Error: Permission denied. No READ permission.
The text was updated successfully, but these errors were encountered: