How to let firebase function emulator use production firebase storage bucket

718 Views Asked by At

so I've initialized a set of firebase functions with firebase init functions via firebase-tools. I then wrote a function as follows:

const functions = require('firebase-functions');

exports.resizeImage = functions.storage.object().onFinalize(async (object) => {
  functions.logger.info("Uploaded object!");
});

I then run my functions on the new emulators with cd functions npm run serve. I then get this message in the log:

i  functions[resizeImage]: function ignored because the storage emulator does not exist or is not running.

I also attempted to do firebase init storage for the project to see if that helps, but it didn't change a thing.

This is confusing... because there doesn't exist a cloud storage emulator. I thought these emulators were supposed for fall back to production resources if the needed emulators weren't available? I see no obvious answer in the docs (unless I glossed over it). Is it possible to run these functions locally before deploying, or do I have to go through the painstaking process of ~~testing~~ hoping my code run correctly hot?

1

There are 1 best solutions below

1
On

I’ve personally tried to run Firebase locally, it works fine, but it doesn’t take changes from nodemon, even when set in package.json

Try AWS , I know it sounds new, but the deployment is easier.

But if you really want to use your cloud functions from an HTTP request you can are given a URL, or you can trigger it by its name

Here is some documentation on event triggering.

https://cloud.google.com/functions/docs/concepts/events-triggers

I also think by your problem you didn’t set up your Firebase correctly, you will need to go to the dashboard and enable all the functionality along with enabling it in the CLI.

Let me know if this helps or if u can reproduce.