Giter Site home page Giter Site logo

firebase-storage-lite's People

Contributors

samuelgozi avatar sesam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

firebase-storage-lite's Issues

Auth Settings

I was doing my testing with auth turned off, but curious how to use auth with file uploads (i.e. can only upload when logged in). I have a logged in user, but I'm not sure what you mean by pass in the auth object. Any help would be appreciated, thanks!
Rules:

rules_version = '2'; service firebase.storage { match /b/{bucket}/o { match /{allPaths=**} { allow read, write: if request.auth != null; } } }

Reference Not Defined? Not Sure How To Get This Working

Hello! This looks awesome, just implemented your Auth package, and so far so good! I'm trying to get this working, but not sure I'm doing it right. Basically trying to make a storage object to work with, but when I do this:
import Reference from 'firestore-storage-lite'; export const storage = new Reference(config.storageBucket);
I get a "Reference is not defined", Rollup says it's missin ga global variable name. Is there any other setup? Would you be able to post a dummy example of setting config and uploading a file? Thanks for the help, can't wait to try it out!

Progress Indicators

Alright, I got some images uploaded!

So it looks like no progress tracking yet, correct? Any hints for large files, or just keep showing a loading symbol?

var uploadTask = testRef.put(blob); uploadTask.start( function(error) { console.log(error); }, function() { console.log("upload complete!"); } );

That upload function doesn't log anything, seems to work the same as uploadTaks.start(), so I'm guessing we can't pass functions. How do you retrieve the metadata from the promise? Thanks for the help, I love how I can use these libraries without a bajillion errors like the official ones!

Network error when trying to upload

I am trying to use the Storagelite module in my react-native app to upload a file to firebase storage but it somehow seems to error out. I am using authlite and firestorelite (with integrated auth) with no issues at all. I am signed in when i issue the request so it isn't a problem with authentication. Since i use Firestorelite with auth, there really is no integration problem since i use the same approach here.

My code:

import Storage from 'firebase-storage-lite';
import { firebaseConfig } from '../../configs/firebase';
import { MediaDataIF } from '../../contexts/CreatePostsContext';
import { auth} from '../'

const bucket = new Storage(firebaseConfig.storageBucket, auth);

const fbStorageUploadMedia = async (mediaObject: MediaDataIF) => {

  const blob = await fetch(mediaObject.path).then(res=>res.blob()); //the mediaObject i get is a JSON and i haven't figured out an optimal/easy way to convert that to a `Blob` in react-native and thus the `fetch`.
    console.log("blob ",blob); //see attached screenshot of DevTools console.
    const upload = bucket.put(blob); 
    console.log("upload ",upload); //see attached screenshot of DevTools console.
    upload.then(meta => {
        console.log(meta);
    });    
    upload.catch(e => {
        console.error("ERROR IN UPLOAD ",e); // see error below
    });    
    upload.finally(() => {
        console.log('done or failed');
    });
}

The error i get is:

ERROR IN UPLOAD  TypeError: Network request failed
    at fetch.umd.js:527
    at JSTimers.js:235
    at _callTimer (JSTimers.js:130)
    at Object.callTimers (JSTimers.js:383)
    at MessageQueue.__callFunction (MessageQueue.js:416)
    at MessageQueue.js:109
    at MessageQueue.__guard (MessageQueue.js:364)
    at MessageQueue.callFunctionReturnFlushedQueue (MessageQueue.js:108)
    at debuggerWorker.cff11639.js:4

Screenshot:

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.