I recently switched over from deprecated multer-gcs to multer-google-storage. I have it mostly running, but cannot figure out how to make the files public. Is there a variable that I can set in the .env file? Right now I get the following when I go to the image page:
<Error>
<Code>AccessDenied</Code>
<Message>Access denied.</Message>
<Details>
Anonymous caller does not have storage.objects.get access to example-app.appspot.com/xxx-yyy-zzz
</Details>
</Error
My code looks like this, and is properly saving everything, except that images are private:
const multer = require('multer');
var multerGoogleStorage = require("multer-google-storage");
dotenv.load({ path: '.env' });
var uploadHandler = multer({
storage: multerGoogleStorage.storageEngine()
});
app.post('/sell', uploadHandler.any(), homeController.postSellPage);
.env File
GCS_BUCKET=example-project.appspot.com
GCLOUD_PROJECT=example-project
GCS_KEYFILE=./example-project-firebase-adminsdk-xxx.json