We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm trying to create test for storage but.. TypeError: Cannot read property 'storageBucket' of null is throw
TypeError: Cannot read property 'storageBucket' of null
"firebase-admin": "^9.1.1". "firebase-functions": "^3.11.0" "firebase-functions-test": "^0.2.2"
Creating new trigger for storage onFinalize and try to test it
onFinalize
Create trigger function that will be trigger on onFinalize
processMenuImages: functions .runWith(runtimeStorageOpts) .storage.object() .onFinalize(processMenuImages),
The processMenuImages function it's just function..
processMenuImages
const processMenuImages = async (object) => { .. code.. }
And try to test...
const functionsTest = require('firebase-functions-test')( FIREBASE_CONFIG, process.env.GOOGLE_APPLICATION_CREDENTIALS ); describe('firebase triggers', function () { let firebaseFunctions; beforeEach(() => { firebaseFunctions = require('.'); }); afterEach(() => { functionsTest.cleanup(); }); test('should be able to call the function', () => { const storageData = functionsTest.storage.makeObjectMetadata({ name: 'unit_tests/Amaze.png', contentType: 'image/png', }); const wrapped = functionsTest.wrap( firebaseFunctions.processMenuImages ); return wrapped(storageData); }); });
Once I start the test, I received this...
TypeError: Cannot read property 'storageBucket' of null 42 | contentType: 'image/png', 43 | }); > 44 | const wrapped = functionsTest.wrap( | ^ 45 | firebaseFunctions.processMenuImages 46 | ); 47 | return wrapped(storageData); at resourceGetter (functions/node_modules/firebase-functions/lib/providers/storage.js:56:53) at Function.get (functions/node_modules/firebase-functions/lib/cloud-functions.js:151:17) at hasPath (functions/node_modules/lodash/lodash.js:6153:24) at Function.has (functions/node_modules/lodash/lodash.js:13185:32) at Object.wrap (functions/node_modules/firebase-functions-test/lib/main.js:29:19) at Suite._context4 (functions/firebase-triggers.test.js:44:39)
Should all test working..
The text was updated successfully, but these errors were encountered:
You need to either pass a bucket explicitly, e.g.
processMenuImages: functions .runWith(runtimeStorageOpts) .storage.bucket("SOME_BUCKET").object() .onFinalize(processMenuImages),
or you need to set the FIREBASE_CONFIG environment variable, which includes a default bucket name.
FIREBASE_CONFIG
Sorry, something went wrong.
No branches or pull requests
I'm trying to create test for storage but..
TypeError: Cannot read property 'storageBucket' of null
is throwVersion info
"firebase-admin": "^9.1.1".
"firebase-functions": "^3.11.0"
"firebase-functions-test": "^0.2.2"
Test case
Creating new trigger for storage
onFinalize
and try to test itSteps to reproduce
Create trigger function that will be trigger on
onFinalize
The
processMenuImages
function it's just function..And try to test...
Actual behavior
Once I start the test, I received this...
Expected behavior
Should all test working..
The text was updated successfully, but these errors were encountered: