diff --git a/app/views/publishPhotos.ejs b/app/views/publishPhotos.ejs index 39d956c..e8cd4ff 100644 --- a/app/views/publishPhotos.ejs +++ b/app/views/publishPhotos.ejs @@ -9,8 +9,8 @@
\ No newline at end of file diff --git a/index.js b/index.js index 1495b4e..3fd2256 100644 --- a/index.js +++ b/index.js @@ -58,40 +58,23 @@ setInterval(checkUpNotify, 1000 * 60 * 60 * 24); const PROJECT_ID = "marketalarm"; const KEY_FILENAME = "marketalarm-262e746e533c.json"; //relative path const BUCKET_NAME = "marketalarm-photos"; - +//Tried implicitly creating with env credentials and direktcly as here const storage = new Storage({ projectId: PROJECT_ID, keyFilename: KEY_FILENAME }); const bucket = storage.bucket(BUCKET_NAME); -/* -async function generateSignedUrl() { - const options = { - version: "v2", - action: "write", - expires: Date.now() + 86400000 - }; - - const [url] = bucket.file("aFile").getSignedUrl(options); - - console.log(`The signed url for aFile is ${url}.`); - return url; -}*/ - -//generateSignedUrl().catch(console.error); app.get("/generateSignedURL", (req, res) => { async function generateSignedUrl() { console.log("Started server function!"); const options = { - // GoogleAccessID: - // " kivi-original-photos-id@marketalarm.iam.gserviceaccount.com", - // PrivateKey: "dd909e0aeef15920e7fc18229ce421246c143f90", - version: "v2", + //Tried to define Google ID and private key while debugging + version: "v2", //tried v4 also action: "write", - contentType: "image/*", + contentType: "image/*", //tried without and with specific image/png ex. expires: Date.now() + 86400000 }; const filename = req.query.filename; @@ -104,6 +87,5 @@ app.get("/generateSignedURL", (req, res) => { console.log(`The signed url for ${filename} is ${url}.`); res.send(url); } - generateSignedUrl().catch(console.error); });