firebase / functions-samples

Collection of sample apps showcasing popular use cases using Cloud Functions for Firebase
https://firebase.google.com/docs/functions
Apache License 2.0
12.06k stars 3.84k forks source link

FFMPEG import error #541

Open SweetmanTech opened 5 years ago

SweetmanTech commented 5 years ago

How to reproduce these conditions

1) clone git repo for firebase/function-samples 2) cd ffmpeg project 3) firebase add 4) firebase deploy 5) ERROR

image

Sample name or URL where you found the bug https://github.com/firebase/functions-samples/blob/Node-8/ffmpeg-convert-audio/functions/index.js

Failing Function code used (including require/import commands at the top)

const functions = require('firebase-functions');
const gcs = require('@google-cloud/storage')();
const path = require('path');
const os = require('os');
const fs = require('fs');
const ffmpeg = require('fluent-ffmpeg');
const ffmpeg_static = require('ffmpeg-static');

Steps to set up and reproduce

1) clone git repo for firebase/function-samples 2) cd ffmpeg project 3) firebase add 4) firebase deploy 5) ERROR

Sample data pasted or attached as JSON (not an image)

Security rules used

Debug output

Errors in the console logs

Screenshots

Expected behavior

Deploy successfully to Firebase Cloud Functions!

Actual behavior

ERROR - module import fails for firebase cloud storage

shlomi-lachmish commented 4 years ago

You can check issue #472

TLDR - change lines 19 & 57 with:

const gcs = require('@google-cloud/storage');
const bucket = new gcs.Storage().bucket(fileBucket);