Cloud Storage for Firebase: uploading of base64 string on Web fails












0















I have read quite a few posts about this (e.g. Save base64 encoded image to Firebase Storage) but cannot make it work.



I am using the example from https://firebase.google.com/docs/storage/web/upload-files#upload_from_a_string (doing this in React Native):



console.log('Writing a base64 string');
ref = await firebase.storage().ref('test').child(Date.now().toString());
message = '5b6p5Y+344GX44G+44GX44Gf77yB44GK44KB44Gn44Go44GG77yB';
await ref.putString(message, 'base64').then(snapshot => {
console.log('.... Done');
});


And I get the following error:



[17:53:23] Possible Unhandled Promise Rejection (id: 0):
[17:53:23] FirebaseStorageError {
[17:53:23] "code_": "storage/invalid-format",
[17:53:23] "message_": "Firebase Storage: String does not match format 'base64': Invalid character found",
[17:53:23] "name_": "FirebaseError",
[17:53:23] "serverResponse_": null,
[17:53:23] }









share|improve this question

























  • Are you sure that's a valid base64 string?

    – Doug Stevenson
    Nov 13 '18 at 16:39











  • I took this from the example in firebase.google.com/docs/storage/web/…. I also tried shorter strings, like 'dGV4dA==' (encoded 'text' in base64encode.org)

    – Yossi
    Nov 13 '18 at 16:47











  • Then you should file a bug report. firebase.google.com/support/contact/bugs-features

    – Doug Stevenson
    Nov 13 '18 at 16:49











  • Thanks Doug, I will. It seems, however, that it works for some people... See stackoverflow.com/questions/37352884/….

    – Yossi
    Nov 13 '18 at 17:01











  • Thanks to @soutot it works. See: stackoverflow.com/questions/52157253/…

    – Yossi
    Nov 13 '18 at 21:30
















0















I have read quite a few posts about this (e.g. Save base64 encoded image to Firebase Storage) but cannot make it work.



I am using the example from https://firebase.google.com/docs/storage/web/upload-files#upload_from_a_string (doing this in React Native):



console.log('Writing a base64 string');
ref = await firebase.storage().ref('test').child(Date.now().toString());
message = '5b6p5Y+344GX44G+44GX44Gf77yB44GK44KB44Gn44Go44GG77yB';
await ref.putString(message, 'base64').then(snapshot => {
console.log('.... Done');
});


And I get the following error:



[17:53:23] Possible Unhandled Promise Rejection (id: 0):
[17:53:23] FirebaseStorageError {
[17:53:23] "code_": "storage/invalid-format",
[17:53:23] "message_": "Firebase Storage: String does not match format 'base64': Invalid character found",
[17:53:23] "name_": "FirebaseError",
[17:53:23] "serverResponse_": null,
[17:53:23] }









share|improve this question

























  • Are you sure that's a valid base64 string?

    – Doug Stevenson
    Nov 13 '18 at 16:39











  • I took this from the example in firebase.google.com/docs/storage/web/…. I also tried shorter strings, like 'dGV4dA==' (encoded 'text' in base64encode.org)

    – Yossi
    Nov 13 '18 at 16:47











  • Then you should file a bug report. firebase.google.com/support/contact/bugs-features

    – Doug Stevenson
    Nov 13 '18 at 16:49











  • Thanks Doug, I will. It seems, however, that it works for some people... See stackoverflow.com/questions/37352884/….

    – Yossi
    Nov 13 '18 at 17:01











  • Thanks to @soutot it works. See: stackoverflow.com/questions/52157253/…

    – Yossi
    Nov 13 '18 at 21:30














0












0








0








I have read quite a few posts about this (e.g. Save base64 encoded image to Firebase Storage) but cannot make it work.



I am using the example from https://firebase.google.com/docs/storage/web/upload-files#upload_from_a_string (doing this in React Native):



console.log('Writing a base64 string');
ref = await firebase.storage().ref('test').child(Date.now().toString());
message = '5b6p5Y+344GX44G+44GX44Gf77yB44GK44KB44Gn44Go44GG77yB';
await ref.putString(message, 'base64').then(snapshot => {
console.log('.... Done');
});


And I get the following error:



[17:53:23] Possible Unhandled Promise Rejection (id: 0):
[17:53:23] FirebaseStorageError {
[17:53:23] "code_": "storage/invalid-format",
[17:53:23] "message_": "Firebase Storage: String does not match format 'base64': Invalid character found",
[17:53:23] "name_": "FirebaseError",
[17:53:23] "serverResponse_": null,
[17:53:23] }









share|improve this question
















I have read quite a few posts about this (e.g. Save base64 encoded image to Firebase Storage) but cannot make it work.



I am using the example from https://firebase.google.com/docs/storage/web/upload-files#upload_from_a_string (doing this in React Native):



console.log('Writing a base64 string');
ref = await firebase.storage().ref('test').child(Date.now().toString());
message = '5b6p5Y+344GX44G+44GX44Gf77yB44GK44KB44Gn44Go44GG77yB';
await ref.putString(message, 'base64').then(snapshot => {
console.log('.... Done');
});


And I get the following error:



[17:53:23] Possible Unhandled Promise Rejection (id: 0):
[17:53:23] FirebaseStorageError {
[17:53:23] "code_": "storage/invalid-format",
[17:53:23] "message_": "Firebase Storage: String does not match format 'base64': Invalid character found",
[17:53:23] "name_": "FirebaseError",
[17:53:23] "serverResponse_": null,
[17:53:23] }






firebase react-native firebase-storage






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 16:37









Doug Stevenson

74.8k987107




74.8k987107










asked Nov 13 '18 at 16:00









YossiYossi

1,6272720




1,6272720













  • Are you sure that's a valid base64 string?

    – Doug Stevenson
    Nov 13 '18 at 16:39











  • I took this from the example in firebase.google.com/docs/storage/web/…. I also tried shorter strings, like 'dGV4dA==' (encoded 'text' in base64encode.org)

    – Yossi
    Nov 13 '18 at 16:47











  • Then you should file a bug report. firebase.google.com/support/contact/bugs-features

    – Doug Stevenson
    Nov 13 '18 at 16:49











  • Thanks Doug, I will. It seems, however, that it works for some people... See stackoverflow.com/questions/37352884/….

    – Yossi
    Nov 13 '18 at 17:01











  • Thanks to @soutot it works. See: stackoverflow.com/questions/52157253/…

    – Yossi
    Nov 13 '18 at 21:30



















  • Are you sure that's a valid base64 string?

    – Doug Stevenson
    Nov 13 '18 at 16:39











  • I took this from the example in firebase.google.com/docs/storage/web/…. I also tried shorter strings, like 'dGV4dA==' (encoded 'text' in base64encode.org)

    – Yossi
    Nov 13 '18 at 16:47











  • Then you should file a bug report. firebase.google.com/support/contact/bugs-features

    – Doug Stevenson
    Nov 13 '18 at 16:49











  • Thanks Doug, I will. It seems, however, that it works for some people... See stackoverflow.com/questions/37352884/….

    – Yossi
    Nov 13 '18 at 17:01











  • Thanks to @soutot it works. See: stackoverflow.com/questions/52157253/…

    – Yossi
    Nov 13 '18 at 21:30

















Are you sure that's a valid base64 string?

– Doug Stevenson
Nov 13 '18 at 16:39





Are you sure that's a valid base64 string?

– Doug Stevenson
Nov 13 '18 at 16:39













I took this from the example in firebase.google.com/docs/storage/web/…. I also tried shorter strings, like 'dGV4dA==' (encoded 'text' in base64encode.org)

– Yossi
Nov 13 '18 at 16:47





I took this from the example in firebase.google.com/docs/storage/web/…. I also tried shorter strings, like 'dGV4dA==' (encoded 'text' in base64encode.org)

– Yossi
Nov 13 '18 at 16:47













Then you should file a bug report. firebase.google.com/support/contact/bugs-features

– Doug Stevenson
Nov 13 '18 at 16:49





Then you should file a bug report. firebase.google.com/support/contact/bugs-features

– Doug Stevenson
Nov 13 '18 at 16:49













Thanks Doug, I will. It seems, however, that it works for some people... See stackoverflow.com/questions/37352884/….

– Yossi
Nov 13 '18 at 17:01





Thanks Doug, I will. It seems, however, that it works for some people... See stackoverflow.com/questions/37352884/….

– Yossi
Nov 13 '18 at 17:01













Thanks to @soutot it works. See: stackoverflow.com/questions/52157253/…

– Yossi
Nov 13 '18 at 21:30





Thanks to @soutot it works. See: stackoverflow.com/questions/52157253/…

– Yossi
Nov 13 '18 at 21:30












0






active

oldest

votes











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


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284885%2fcloud-storage-for-firebase-uploading-of-base64-string-on-web-fails%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284885%2fcloud-storage-for-firebase-uploading-of-base64-string-on-web-fails%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

Full-time equivalent

さくらももこ

13 indicted, 8 arrested in Calif. drug cartel investigation