Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Scope Cloud Function to an individual bucket on local Cloud Storage Emulator #3932

Closed
marcfrankel opened this issue Dec 6, 2021 · 3 comments

Comments

@marcfrankel
Copy link

[REQUIRED] Environment info

firebase-tools: 9.23.0

Platform: macOS 12.0.1 (Intel Mac)

[REQUIRED] Test case

I am trying to scope a Cloud Storage triggered cloud function to a specific storage bucket as the documentation explains here: https://firebase.google.com/docs/storage/extend-with-functions. However, on the local emulator, the function is run no matter what bucket a file is uploaded to. This appears to be a bug in the local emulator because if I deploy the same function to Firebase it runs as one would expect there.

[REQUIRED] Steps to reproduce

  1. Create a Cloud Storage triggered function.
  2. Scope function to a specific bucket
  3. Upload a file to that specific bucket
  4. Upload file to any other or default bucket
  5. Function should have triggered both times despite being scoped to only run once.

Sample Code:
export const transformProfileImage = functions.storage.bucket('scoped_bucket_name').object().onFinalize(async (file) => { console.log(file.name); });

[REQUIRED] Expected behavior

The expected behavior is that the Cloud Function should only run when a file is uploaded to the scoped cloud bucket.

[REQUIRED] Actual behavior

It actually runs no matter what bucket I uploaded it to on the local emulator. However, the expected behavior is correct if the function is deployed to firebase.

@abeisgoat abeisgoat self-assigned this Dec 6, 2021
@abeisgoat
Copy link
Contributor

This is a known issue which I believe has been addressed by @colerogers, but he can verify.

@colerogers
Copy link
Contributor

I currently have a PR out for this fix - #3893

@abeisgoat Can I get your sign off before merging it?

@colerogers
Copy link
Contributor

Hi @marcfrankel the fix was merged and we will ship it with our next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants