Open ghost opened 6 years ago
I guess you should go to Storage page in Firebase Console and add a bucket. Also, try to make the storage public https://cloud.google.com/storage/docs/access-control/making-data-public Let me know if this doesn't work I will try to remember what I did, it's been a while since I created this project
Hi, Thanks for coming back so quickly! I am using the default bucket as its free. Should it work with this or should I add a new bucket?
I also use the default one. According to firebase documentation, this should be automatically populated in runtime https://firebase.google.com/docs/functions/config-env
Maybe you can just test it with replacing the config with the name of your bucket, in my case, the name looks like this onlinestore-2e046.appspot.com
I had the same problem due to the difference in firebase-functions versions. Don't forget to lock dependencies like me)
When I try to call the products API, firebase reports the following error in index.js
TypeError: Cannot read property 'storageBucket' of undefined at app.get (/user_code/index.js:17:30) at Layer.handle [as handle_request] (/user_code/node_modules/express/lib/router/layer.js:95:5) at next (/user_code/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/user_code/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/user_code/node_modules/express/lib/router/layer.js:95:5) at /user_code/node_modules/express/lib/router/index.js:281:22 at Function.process_params (/user_code/node_modules/express/lib/router/index.js:335:12) at next (/user_code/node_modules/express/lib/router/index.js:275:10) at cors (/user_code/node_modules/cors/lib/index.js:188:7) at /user_code/node_modules/cors/lib/index.js:224:17
Looking at the code in app.get('/products', (req, res) => {} I see the following:
const imageBaseUrl = 'https://storage.googleapis.com/' + functions.config().firebase.storageBucket + '/resized/';
Any ideas why the storageBucket is not set?