{"action":"created","issue":{"url":"https://api.github.com/repos/NUS-ALSET/achievements/issues/448","repository_url":"https://api.github.com/repos/NUS-ALSET/achievements","labels_url":"https://api.github.com/repos/NUS-ALSET/achievements/issues/448/labels{/name}","comments_url":"https://api.github.com/repos/NUS-ALSET/achievements/issues/448/comments","events_url":"https://api.github.com/repos/NUS-ALSET/achievements/issues/448/events","html_url":"https://github.com/NUS-ALSET/achievements/issues/448","id":362477985,"node_id":"MDU6SXNzdWUzNjI0Nzc5ODU=","number":448,"title":"Functions directory launch `npm start` encountered UnhandledPromiseRejectionWarning","user":{"login":"FeynmanDNA","id":26617036,"node_id":"MDQ6VXNlcjI2NjE3MDM2","avatar_url":"https://avatars3.githubusercontent.com/u/26617036?v=4","gravatar_id":"","url":"https://api.github.com/users/FeynmanDNA","html_url":"https://github.com/FeynmanDNA","followers_url":"https://api.github.com/users/FeynmanDNA/followers","following_url":"https://api.github.com/users/FeynmanDNA/following{/other_user}","gists_url":"https://api.github.com/users/FeynmanDNA/gists{/gist_id}","starred_url":"https://api.github.com/users/FeynmanDNA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FeynmanDNA/subscriptions","organizations_url":"https://api.github.com/users/FeynmanDNA/orgs","repos_url":"https://api.github.com/users/FeynmanDNA/repos","events_url":"https://api.github.com/users/FeynmanDNA/events{/privacy}","received_events_url":"https://api.github.com/users/FeynmanDNA/received_events","type":"User","site_admin":false},"labels":[{"id":1064393697,"node_id":"MDU6TGFiZWwxMDY0MzkzNjk3","url":"https://api.github.com/repos/NUS-ALSET/achievements/labels/Functions","name":"Functions","color":"5319e7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":24,"created_at":"2018-09-21T06:49:46Z","updated_at":"2018-09-21T09:11:05Z","closed_at":"2018-09-21T09:09:58Z","author_association":"MEMBER","body":"I obtained the serviceAccountKey.json from achievements-dev firebase console, and implemented the following code in:\r\n```javascript\r\nconst serviceAccount = require(\"./config/serviceAccountKey.json\");\r\n\r\nadmin.initializeApp({\r\n  credential: admin.credential.cert(serviceAccount),\r\n  databaseURL: \"https://achievements-dev.firebaseio.com\"\r\n});\r\n```\r\nAnd I created a directory called `config/` in the functions folder and put the serviceAccountKey.json inside:\r\n![image](https://user-images.githubusercontent.com/26617036/45864194-c495a980-bdab-11e8-83c9-fce9c884c926.png)\r\n\r\nHowever, when I run `npm start` in the functions folder, I received the following error from node:\r\n```shell\r\n$: ~/achievements-my-local/functions$ npm start\r\n\r\n> functions@ start /home/tanuki/Documents/Work/NUS-ALSET/achievements-my-local/functions\r\n> firebase serve --only functions & node ./localTriggers.js\r\n\r\n(node:18634) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404\r\n    at createError (/home/tanuki/Documents/Work/NUS-ALSET/achievements-my-local/functions/node_modules/axios/lib/core/createError.js:16:15)\r\n    at settle (/home/tanuki/Documents/Work/NUS-ALSET/achievements-my-local/functions/node_modules/axios/lib/core/settle.js:18:12)\r\n    at IncomingMessage.handleStreamEnd (/home/tanuki/Documents/Work/NUS-ALSET/achievements-my-local/functions/node_modules/axios/lib/adapters/http.js:192:11)\r\n    at IncomingMessage.emit (events.js:187:15)\r\n    at endReadableNT (_stream_readable.js:1092:12)\r\n    at process._tickCallback (internal/process/next_tick.js:63:19)\r\n(node:18634) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)\r\n(node:18634) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.\r\nRequest failed with status code 502\r\n\r\n=== Serving from '/home/tanuki/Documents/Work/NUS-ALSET/achievements-my-local'...\r\n\r\n\r\nError: An unexpected error has occurred.\r\nRequest failed with status code 502\r\nRequest failed with status code 502\r\nRequest failed with status code 502\r\n```\r\n\r\nI basically followed the tutorial from firebase-admin SDK (https://firebase.google.com/docs/admin/setup), the serviceAccountKey.json is obtained from achievements-dev firebase console, and the code snippets are exactly the same as the ones shown in the tutorial. So I am wondering what is causing the error here?"},"comment":{"url":"https://api.github.com/repos/NUS-ALSET/achievements/issues/comments/423467920","html_url":"https://github.com/NUS-ALSET/achievements/issues/448#issuecomment-423467920","issue_url":"https://api.github.com/repos/NUS-ALSET/achievements/issues/448","id":423467920,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzQ2NzkyMA==","user":{"login":"FeynmanDNA","id":26617036,"node_id":"MDQ6VXNlcjI2NjE3MDM2","avatar_url":"https://avatars3.githubusercontent.com/u/26617036?v=4","gravatar_id":"","url":"https://api.github.com/users/FeynmanDNA","html_url":"https://github.com/FeynmanDNA","followers_url":"https://api.github.com/users/FeynmanDNA/followers","following_url":"https://api.github.com/users/FeynmanDNA/following{/other_user}","gists_url":"https://api.github.com/users/FeynmanDNA/gists{/gist_id}","starred_url":"https://api.github.com/users/FeynmanDNA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FeynmanDNA/subscriptions","organizations_url":"https://api.github.com/users/FeynmanDNA/orgs","repos_url":"https://api.github.com/users/FeynmanDNA/repos","events_url":"https://api.github.com/users/FeynmanDNA/events{/privacy}","received_events_url":"https://api.github.com/users/FeynmanDNA/received_events","type":"User","site_admin":false},"created_at":"2018-09-21T09:11:05Z","updated_at":"2018-09-21T09:11:05Z","author_association":"MEMBER","body":"thanks so much for the communication! cheers"}}
{"actor":{"display_login":"FeynmanDNA"}}