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

storage-resize-images extension emulator not working #289

Open
th0rgall opened this issue Jan 16, 2023 · 0 comments
Open

storage-resize-images extension emulator not working #289

th0rgall opened this issue Jan 16, 2023 · 0 comments
Labels
[Type] Bug Something isn't working

Comments

@th0rgall
Copy link
Contributor

th0rgall commented Jan 16, 2023

While working on #288, the only thing that I couldn't figure out was how to get the storage-resize-images extension to function locally.

Problem 1: installing for demo-test

firebase --project demo-test ext:install --local firebase/storage-resize-images

It crashes with:

i  extensions: ensuring required API firebaseextensions.googleapis.com is enabled...

Error: HTTP Error: 403, Permission denied to get service [firebaseextensions.googleapis.com]

First running firebase use wtmg-dev, and omitting the --project demo-test afterwards seems to work: it starts the configuration wizard, and dumps an extension .env file.

(workaround) Afterwards, editing extensions/storage-resize-images.env and changing wtmg-dev.appspot.com to demo-test.appspot.com makes the extension run in the demo-test rpoject too.

Problem 2: resized versions are not being created

CleanShot 2023-01-16 at 13 42 06@2x

With the extension disabled locally, images get uploaded as expected to the local storage emulator:

CleanShot 2023-01-16 at 13 40 47@2x

With the extension enabled, and original file deletion enabled (as is the production setting), the original file will get deleted, but the resized files will not be created.

The expected content, with the operation of the extension however, looks like this:

CleanShot 2023-01-16 at 13 32 12@2x

I tried this both with the local-only demo-test project, and with wtmg-dev (with all emulators enabled/overriding production).

wtmg-dev emulator log with original image deletion enabled
i  functions: Beginning execution of "generateResizedImage"
>  {"bucket":"wtmg-dev.appspot.com","cacheControlHeader":"86400","imageSizes":["1920x1080","500x500","360x360"],"deleteOriginalFile":0,"animated":false,"severity":"INFO","message":"Started execution of extension with configuration"}
>  {"severity":"INFO","message":"Creating temporary directory: '/var/folders/0m/d2znfz1n41d599lzrhwyzfwh0000gn/T/gardens/0Cmy5jigOhuyBWoEf2lgk4k6G1Ym'"}
>  {"severity":"INFO","message":"Created temporary directory: '/var/folders/0m/d2znfz1n41d599lzrhwyzfwh0000gn/T/gardens/0Cmy5jigOhuyBWoEf2lgk4k6G1Ym'"}
>  {"severity":"INFO","message":"Downloading image file: 'gardens/0Cmy5jigOhuyBWoEf2lgk4k6G1Ym/garden.jpeg'"}
>  {"severity":"INFO","message":"Downloaded image file: 'gardens/0Cmy5jigOhuyBWoEf2lgk4k6G1Ym/garden.jpeg' to '/var/folders/0m/d2znfz1n41d599lzrhwyzfwh0000gn/T/gardens/0Cmy5jigOhuyBWoEf2lgk4k6G1Ym/garden.jpeg'"}
>  {"severity":"INFO","message":"Completed execution of extension"}
>  {"severity":"INFO","message":"Deleting temporary original file: 'gardens/0Cmy5jigOhuyBWoEf2lgk4k6G1Ym/garden.jpeg'"}
>  {"severity":"INFO","message":"Deleted temporary original file: 'gardens/0Cmy5jigOhuyBWoEf2lgk4k6G1Ym/garden.jpeg'"}
>  {"severity":"INFO","message":"Deleting original file from storage bucket: 'gardens/0Cmy5jigOhuyBWoEf2lgk4k6G1Ym/garden.jpeg'"}
>  {"severity":"INFO","message":"Deleted original file from storage bucket: 'gardens/0Cmy5jigOhuyBWoEf2lgk4k6G1Ym/garden.jpeg'"}
i  functions: Finished "generateResizedImage" in 125.425958ms
demo-test function log with original image deletion disabled
i  functions: Beginning execution of "generateResizedImage"
>  {"bucket":"demo-test.appspot.com","cacheControlHeader":"86400","imageSizes":["1920x1080","500x500","360x360"],"deleteOriginalFile":1,"animated":false,"severity":"INFO","message":"Started execution of extension with configuration"}
>  {"severity":"INFO","message":"Creating temporary directory: '/var/folders/0m/d2znfz1n41d599lzrhwyzfwh0000gn/T/gardens/MRYAyjTLmcu8vNpegeQhqcIxtZxa'"}
>  {"severity":"INFO","message":"Created temporary directory: '/var/folders/0m/d2znfz1n41d599lzrhwyzfwh0000gn/T/gardens/MRYAyjTLmcu8vNpegeQhqcIxtZxa'"}
>  {"severity":"INFO","message":"Downloading image file: 'gardens/MRYAyjTLmcu8vNpegeQhqcIxtZxa/garden.jpeg'"}
>  {"severity":"INFO","message":"Downloaded image file: 'gardens/MRYAyjTLmcu8vNpegeQhqcIxtZxa/garden.jpeg' to '/var/folders/0m/d2znfz1n41d599lzrhwyzfwh0000gn/T/gardens/MRYAyjTLmcu8vNpegeQhqcIxtZxa/garden.jpeg'"}
>  {"severity":"INFO","message":"Completed execution of extension"}
>  {"severity":"INFO","message":"Deleting temporary original file: 'gardens/MRYAyjTLmcu8vNpegeQhqcIxtZxa/garden.jpeg'"}
>  {"severity":"INFO","message":"Deleted temporary original file: 'gardens/MRYAyjTLmcu8vNpegeQhqcIxtZxa/garden.jpeg'"}
0.1.8 config
CACHE_CONTROL_HEADER=86400
DELETE_ORIGINAL_FILE=true
IMG_BUCKET=wtmg-dev.appspot.com
IMG_SIZES=1920x1080,500x500,360x360
LOCATION=europe-west1
0.1.33
CACHE_CONTROL_HEADER=86400
DELETE_ORIGINAL_FILE=true
DO_BACKFILL=false
FUNCTION_MEMORY=1024
IMG_BUCKET=wtmg-dev.appspot.com
IMG_SIZES=1920x1080,500x500,360x360
IS_ANIMATED=false
LOCATION=europe-west1
MAKE_PUBLIC=false
firebase.json excerpt
"extensions": {
    // latest
    "storage-resize-images": "firebase/[email protected]",
    // prod
    "storage-resize-images": "firebase/[email protected]",
    // staging
    "storage-resize-images": "firebase/[email protected]"
  }

Problem 3: can't use while logged out in the Firebase CLI

This is maybe not something we can fix.

Error: Errors while reading 'extensions' in 'firebase.json'
- HTTP Error: 401, Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
@th0rgall th0rgall added the [Type] Bug Something isn't working label Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant