How to delete/download files from the firebase dashboard that were uploaded using the firebase-admin SDK?












1














I have uploaded files using the admin-sdk for firebase but it appears I cannot download/delete them using the firebase dashboard. This isn't necessarily a problem as I won't be managing my files this way but it does seem odd.



// Initialization
import * as firebase from 'firebase-admin';
const serviceAccount = require('../firebase_creds');
firebase.initializeApp({
credential: firebase.credential.cert(serviceAccount),
databaseURL: 'https://my-databse.firebaseio.com',
storageBucket: 'gs://my-bucket.appspot.com'
});

export const uploadImages = async () => {
const bucket = firebase.storage().bucket();
try {
const file = await bucket.upload('./images/1-Website.jpg', {
public: true,
destination: `12345/displayPicture/1-Website.jpg`
});
console.log(file);
} catch (error) {
console.log(error);
}
};









share|improve this question









New contributor




Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Go to the Google Cloud Console -> Storage -> Browser. You should see your bucket there.
    – John Hanley
    2 days ago










  • Yeah I can see it all there and have full access to download, view, delete etc but when I am using the firebase dashboard all I can do is list the files. Seems to me it's not uploading with the correct permissions or ACL.
    – Joe Hill
    2 days ago
















1














I have uploaded files using the admin-sdk for firebase but it appears I cannot download/delete them using the firebase dashboard. This isn't necessarily a problem as I won't be managing my files this way but it does seem odd.



// Initialization
import * as firebase from 'firebase-admin';
const serviceAccount = require('../firebase_creds');
firebase.initializeApp({
credential: firebase.credential.cert(serviceAccount),
databaseURL: 'https://my-databse.firebaseio.com',
storageBucket: 'gs://my-bucket.appspot.com'
});

export const uploadImages = async () => {
const bucket = firebase.storage().bucket();
try {
const file = await bucket.upload('./images/1-Website.jpg', {
public: true,
destination: `12345/displayPicture/1-Website.jpg`
});
console.log(file);
} catch (error) {
console.log(error);
}
};









share|improve this question









New contributor




Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Go to the Google Cloud Console -> Storage -> Browser. You should see your bucket there.
    – John Hanley
    2 days ago










  • Yeah I can see it all there and have full access to download, view, delete etc but when I am using the firebase dashboard all I can do is list the files. Seems to me it's not uploading with the correct permissions or ACL.
    – Joe Hill
    2 days ago














1












1








1


1





I have uploaded files using the admin-sdk for firebase but it appears I cannot download/delete them using the firebase dashboard. This isn't necessarily a problem as I won't be managing my files this way but it does seem odd.



// Initialization
import * as firebase from 'firebase-admin';
const serviceAccount = require('../firebase_creds');
firebase.initializeApp({
credential: firebase.credential.cert(serviceAccount),
databaseURL: 'https://my-databse.firebaseio.com',
storageBucket: 'gs://my-bucket.appspot.com'
});

export const uploadImages = async () => {
const bucket = firebase.storage().bucket();
try {
const file = await bucket.upload('./images/1-Website.jpg', {
public: true,
destination: `12345/displayPicture/1-Website.jpg`
});
console.log(file);
} catch (error) {
console.log(error);
}
};









share|improve this question









New contributor




Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have uploaded files using the admin-sdk for firebase but it appears I cannot download/delete them using the firebase dashboard. This isn't necessarily a problem as I won't be managing my files this way but it does seem odd.



// Initialization
import * as firebase from 'firebase-admin';
const serviceAccount = require('../firebase_creds');
firebase.initializeApp({
credential: firebase.credential.cert(serviceAccount),
databaseURL: 'https://my-databse.firebaseio.com',
storageBucket: 'gs://my-bucket.appspot.com'
});

export const uploadImages = async () => {
const bucket = firebase.storage().bucket();
try {
const file = await bucket.upload('./images/1-Website.jpg', {
public: true,
destination: `12345/displayPicture/1-Website.jpg`
});
console.log(file);
} catch (error) {
console.log(error);
}
};






firebase google-cloud-storage






share|improve this question









New contributor




Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 days ago









B001ᛦ

1,11051220




1,11051220






New contributor




Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









Joe Hill

62




62




New contributor




Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Go to the Google Cloud Console -> Storage -> Browser. You should see your bucket there.
    – John Hanley
    2 days ago










  • Yeah I can see it all there and have full access to download, view, delete etc but when I am using the firebase dashboard all I can do is list the files. Seems to me it's not uploading with the correct permissions or ACL.
    – Joe Hill
    2 days ago


















  • Go to the Google Cloud Console -> Storage -> Browser. You should see your bucket there.
    – John Hanley
    2 days ago










  • Yeah I can see it all there and have full access to download, view, delete etc but when I am using the firebase dashboard all I can do is list the files. Seems to me it's not uploading with the correct permissions or ACL.
    – Joe Hill
    2 days ago
















Go to the Google Cloud Console -> Storage -> Browser. You should see your bucket there.
– John Hanley
2 days ago




Go to the Google Cloud Console -> Storage -> Browser. You should see your bucket there.
– John Hanley
2 days ago












Yeah I can see it all there and have full access to download, view, delete etc but when I am using the firebase dashboard all I can do is list the files. Seems to me it's not uploading with the correct permissions or ACL.
– Joe Hill
2 days ago




Yeah I can see it all there and have full access to download, view, delete etc but when I am using the firebase dashboard all I can do is list the files. Seems to me it's not uploading with the correct permissions or ACL.
– Joe Hill
2 days ago












2 Answers
2






active

oldest

votes


















0














By passing in predefinedAcl: 'bucketOwnerFullControl' to the upload options fixes this issue. As usual the firebase documentation is very vague and does't mention this anywhere.






share|improve this answer








New contributor




Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • Joe can you show how you are using this and the changes to your code?
    – John Hanley
    2 days ago










  • What roles does the firebase credentials that you were using have? Your solution makes sense, but then again it does not.
    – John Hanley
    2 days ago










  • The Firebase Admin SDK just wraps the underlying Cloud Storage SDK (@google-cloud/storage). If you want comprehensive documentation, use the Cloud docs instead of the Firebase docs.
    – Doug Stevenson
    2 days ago












  • @DougStevenson - My comment is that the solution does not make sense to me. If the project owner is creating the object thru Firebase, why does this ACL need to be specified? The owner should still have all permissions even for an object created public. The issue is that by assigning bucketOwnerFullControl, public access is removed. This solves one problem but creates another. publicRead grants OWNER permission so bucketOwnerFullControl should not be required. I am misising something and that is why I am following this thread.
    – John Hanley
    2 days ago



















0














I found the cause of this problem in Google documentation.



Short summary: "after you apply the predefined ACL publicRead to the object, you lose OWNER permission and thus no longer can access the object ACL"




Caution: By applying a predefined ACL to an existing bucket or object,
you completely replace the existing bucket or object ACL with the
predefined ACL. This change might cause you to lose access to the
bucket or object ACL in some cases. For example, if you are in the
project owners group but are not the owner of an object with
projectPrivate ACL, then after you apply the predefined ACL publicRead
to the object, you lose OWNER permission and thus no longer can access
the object ACL. If this occurs, you can use the Cloud IAM role
storage.objectAdmin so that you have the permission necessary to
update the object's ACL and correct the change.




Predefined ACLs






share|improve this answer





















    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
    });


    }
    });






    Joe Hill is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53944835%2fhow-to-delete-download-files-from-the-firebase-dashboard-that-were-uploaded-usin%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









    0














    By passing in predefinedAcl: 'bucketOwnerFullControl' to the upload options fixes this issue. As usual the firebase documentation is very vague and does't mention this anywhere.






    share|improve this answer








    New contributor




    Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.


















    • Joe can you show how you are using this and the changes to your code?
      – John Hanley
      2 days ago










    • What roles does the firebase credentials that you were using have? Your solution makes sense, but then again it does not.
      – John Hanley
      2 days ago










    • The Firebase Admin SDK just wraps the underlying Cloud Storage SDK (@google-cloud/storage). If you want comprehensive documentation, use the Cloud docs instead of the Firebase docs.
      – Doug Stevenson
      2 days ago












    • @DougStevenson - My comment is that the solution does not make sense to me. If the project owner is creating the object thru Firebase, why does this ACL need to be specified? The owner should still have all permissions even for an object created public. The issue is that by assigning bucketOwnerFullControl, public access is removed. This solves one problem but creates another. publicRead grants OWNER permission so bucketOwnerFullControl should not be required. I am misising something and that is why I am following this thread.
      – John Hanley
      2 days ago
















    0














    By passing in predefinedAcl: 'bucketOwnerFullControl' to the upload options fixes this issue. As usual the firebase documentation is very vague and does't mention this anywhere.






    share|improve this answer








    New contributor




    Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.


















    • Joe can you show how you are using this and the changes to your code?
      – John Hanley
      2 days ago










    • What roles does the firebase credentials that you were using have? Your solution makes sense, but then again it does not.
      – John Hanley
      2 days ago










    • The Firebase Admin SDK just wraps the underlying Cloud Storage SDK (@google-cloud/storage). If you want comprehensive documentation, use the Cloud docs instead of the Firebase docs.
      – Doug Stevenson
      2 days ago












    • @DougStevenson - My comment is that the solution does not make sense to me. If the project owner is creating the object thru Firebase, why does this ACL need to be specified? The owner should still have all permissions even for an object created public. The issue is that by assigning bucketOwnerFullControl, public access is removed. This solves one problem but creates another. publicRead grants OWNER permission so bucketOwnerFullControl should not be required. I am misising something and that is why I am following this thread.
      – John Hanley
      2 days ago














    0












    0








    0






    By passing in predefinedAcl: 'bucketOwnerFullControl' to the upload options fixes this issue. As usual the firebase documentation is very vague and does't mention this anywhere.






    share|improve this answer








    New contributor




    Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.









    By passing in predefinedAcl: 'bucketOwnerFullControl' to the upload options fixes this issue. As usual the firebase documentation is very vague and does't mention this anywhere.







    share|improve this answer








    New contributor




    Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.









    share|improve this answer



    share|improve this answer






    New contributor




    Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.









    answered 2 days ago









    Joe Hill

    62




    62




    New contributor




    Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





    New contributor





    Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






    Joe Hill is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.












    • Joe can you show how you are using this and the changes to your code?
      – John Hanley
      2 days ago










    • What roles does the firebase credentials that you were using have? Your solution makes sense, but then again it does not.
      – John Hanley
      2 days ago










    • The Firebase Admin SDK just wraps the underlying Cloud Storage SDK (@google-cloud/storage). If you want comprehensive documentation, use the Cloud docs instead of the Firebase docs.
      – Doug Stevenson
      2 days ago












    • @DougStevenson - My comment is that the solution does not make sense to me. If the project owner is creating the object thru Firebase, why does this ACL need to be specified? The owner should still have all permissions even for an object created public. The issue is that by assigning bucketOwnerFullControl, public access is removed. This solves one problem but creates another. publicRead grants OWNER permission so bucketOwnerFullControl should not be required. I am misising something and that is why I am following this thread.
      – John Hanley
      2 days ago


















    • Joe can you show how you are using this and the changes to your code?
      – John Hanley
      2 days ago










    • What roles does the firebase credentials that you were using have? Your solution makes sense, but then again it does not.
      – John Hanley
      2 days ago










    • The Firebase Admin SDK just wraps the underlying Cloud Storage SDK (@google-cloud/storage). If you want comprehensive documentation, use the Cloud docs instead of the Firebase docs.
      – Doug Stevenson
      2 days ago












    • @DougStevenson - My comment is that the solution does not make sense to me. If the project owner is creating the object thru Firebase, why does this ACL need to be specified? The owner should still have all permissions even for an object created public. The issue is that by assigning bucketOwnerFullControl, public access is removed. This solves one problem but creates another. publicRead grants OWNER permission so bucketOwnerFullControl should not be required. I am misising something and that is why I am following this thread.
      – John Hanley
      2 days ago
















    Joe can you show how you are using this and the changes to your code?
    – John Hanley
    2 days ago




    Joe can you show how you are using this and the changes to your code?
    – John Hanley
    2 days ago












    What roles does the firebase credentials that you were using have? Your solution makes sense, but then again it does not.
    – John Hanley
    2 days ago




    What roles does the firebase credentials that you were using have? Your solution makes sense, but then again it does not.
    – John Hanley
    2 days ago












    The Firebase Admin SDK just wraps the underlying Cloud Storage SDK (@google-cloud/storage). If you want comprehensive documentation, use the Cloud docs instead of the Firebase docs.
    – Doug Stevenson
    2 days ago






    The Firebase Admin SDK just wraps the underlying Cloud Storage SDK (@google-cloud/storage). If you want comprehensive documentation, use the Cloud docs instead of the Firebase docs.
    – Doug Stevenson
    2 days ago














    @DougStevenson - My comment is that the solution does not make sense to me. If the project owner is creating the object thru Firebase, why does this ACL need to be specified? The owner should still have all permissions even for an object created public. The issue is that by assigning bucketOwnerFullControl, public access is removed. This solves one problem but creates another. publicRead grants OWNER permission so bucketOwnerFullControl should not be required. I am misising something and that is why I am following this thread.
    – John Hanley
    2 days ago




    @DougStevenson - My comment is that the solution does not make sense to me. If the project owner is creating the object thru Firebase, why does this ACL need to be specified? The owner should still have all permissions even for an object created public. The issue is that by assigning bucketOwnerFullControl, public access is removed. This solves one problem but creates another. publicRead grants OWNER permission so bucketOwnerFullControl should not be required. I am misising something and that is why I am following this thread.
    – John Hanley
    2 days ago













    0














    I found the cause of this problem in Google documentation.



    Short summary: "after you apply the predefined ACL publicRead to the object, you lose OWNER permission and thus no longer can access the object ACL"




    Caution: By applying a predefined ACL to an existing bucket or object,
    you completely replace the existing bucket or object ACL with the
    predefined ACL. This change might cause you to lose access to the
    bucket or object ACL in some cases. For example, if you are in the
    project owners group but are not the owner of an object with
    projectPrivate ACL, then after you apply the predefined ACL publicRead
    to the object, you lose OWNER permission and thus no longer can access
    the object ACL. If this occurs, you can use the Cloud IAM role
    storage.objectAdmin so that you have the permission necessary to
    update the object's ACL and correct the change.




    Predefined ACLs






    share|improve this answer


























      0














      I found the cause of this problem in Google documentation.



      Short summary: "after you apply the predefined ACL publicRead to the object, you lose OWNER permission and thus no longer can access the object ACL"




      Caution: By applying a predefined ACL to an existing bucket or object,
      you completely replace the existing bucket or object ACL with the
      predefined ACL. This change might cause you to lose access to the
      bucket or object ACL in some cases. For example, if you are in the
      project owners group but are not the owner of an object with
      projectPrivate ACL, then after you apply the predefined ACL publicRead
      to the object, you lose OWNER permission and thus no longer can access
      the object ACL. If this occurs, you can use the Cloud IAM role
      storage.objectAdmin so that you have the permission necessary to
      update the object's ACL and correct the change.




      Predefined ACLs






      share|improve this answer
























        0












        0








        0






        I found the cause of this problem in Google documentation.



        Short summary: "after you apply the predefined ACL publicRead to the object, you lose OWNER permission and thus no longer can access the object ACL"




        Caution: By applying a predefined ACL to an existing bucket or object,
        you completely replace the existing bucket or object ACL with the
        predefined ACL. This change might cause you to lose access to the
        bucket or object ACL in some cases. For example, if you are in the
        project owners group but are not the owner of an object with
        projectPrivate ACL, then after you apply the predefined ACL publicRead
        to the object, you lose OWNER permission and thus no longer can access
        the object ACL. If this occurs, you can use the Cloud IAM role
        storage.objectAdmin so that you have the permission necessary to
        update the object's ACL and correct the change.




        Predefined ACLs






        share|improve this answer












        I found the cause of this problem in Google documentation.



        Short summary: "after you apply the predefined ACL publicRead to the object, you lose OWNER permission and thus no longer can access the object ACL"




        Caution: By applying a predefined ACL to an existing bucket or object,
        you completely replace the existing bucket or object ACL with the
        predefined ACL. This change might cause you to lose access to the
        bucket or object ACL in some cases. For example, if you are in the
        project owners group but are not the owner of an object with
        projectPrivate ACL, then after you apply the predefined ACL publicRead
        to the object, you lose OWNER permission and thus no longer can access
        the object ACL. If this occurs, you can use the Cloud IAM role
        storage.objectAdmin so that you have the permission necessary to
        update the object's ACL and correct the change.




        Predefined ACLs







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 days ago









        John Hanley

        13.6k2528




        13.6k2528






















            Joe Hill is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            Joe Hill is a new contributor. Be nice, and check out our Code of Conduct.













            Joe Hill is a new contributor. Be nice, and check out our Code of Conduct.












            Joe Hill is a new contributor. Be nice, and check out our Code of Conduct.
















            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53944835%2fhow-to-delete-download-files-from-the-firebase-dashboard-that-were-uploaded-usin%23new-answer', 'question_page');
            }
            );

            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







            Popular posts from this blog

            Mossoró

            Error while reading .h5 file using the rhdf5 package in R

            Pushsharp Apns notification error: 'InvalidToken'