{"action":"created","issue":{"url":"https://api.github.com/repos/firebase/firebase-functions/issues/220","repository_url":"https://api.github.com/repos/firebase/firebase-functions","labels_url":"https://api.github.com/repos/firebase/firebase-functions/issues/220/labels{/name}","comments_url":"https://api.github.com/repos/firebase/firebase-functions/issues/220/comments","events_url":"https://api.github.com/repos/firebase/firebase-functions/issues/220/events","html_url":"https://github.com/firebase/firebase-functions/issues/220","id":311840848,"node_id":"MDU6SXNzdWUzMTE4NDA4NDg=","number":220,"title":"\"Error: Can't determine Firebase Database URL.\" after v1 Migration from Beta","user":{"login":"zgosalvez","id":1798166,"node_id":"MDQ6VXNlcjE3OTgxNjY=","avatar_url":"https://avatars1.githubusercontent.com/u/1798166?v=4","gravatar_id":"","url":"https://api.github.com/users/zgosalvez","html_url":"https://github.com/zgosalvez","followers_url":"https://api.github.com/users/zgosalvez/followers","following_url":"https://api.github.com/users/zgosalvez/following{/other_user}","gists_url":"https://api.github.com/users/zgosalvez/gists{/gist_id}","starred_url":"https://api.github.com/users/zgosalvez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zgosalvez/subscriptions","organizations_url":"https://api.github.com/users/zgosalvez/orgs","repos_url":"https://api.github.com/users/zgosalvez/repos","events_url":"https://api.github.com/users/zgosalvez/events{/privacy}","received_events_url":"https://api.github.com/users/zgosalvez/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2018-04-06T03:56:47Z","updated_at":"2018-07-20T21:58:45Z","closed_at":"2018-04-21T00:09:59Z","author_association":"NONE","body":"<!--\r\n\r\nThank you for contributing to the Firebase community!\r\n\r\nHave a usage question?\r\n=======================\r\nWe get lots of those and we love helping you, but GitHub is not the best place for them and they\r\nwill be closed. Here are some resources to get help:\r\n\r\n- Start with the quickstart: https://firebase.google.com/docs/functions/write-firebase-functions\r\n- Go through the guide: https://firebase.google.com/docs/functions/\r\n- Read the full API reference: https://firebase.google.com/docs/reference/functions/\r\n- Browse some examples: https://github.com/firebase/functions-samples\r\n\r\nIf the official documentation doesn't help, try asking through our official support channels:\r\n\r\nhttps://firebase.google.com/support/\r\n\r\n*Please avoid double posting across multiple channels!*\r\n\r\nThink you found a bug?\r\n=======================\r\nYeah, we're definitely not perfect! Please use the bug report template below and include a minimal\r\nrepro when opening the issue.\r\n\r\n\r\nHave a feature request?\r\n========================\r\nGreat, we love hearing how we can improve our products! Please submit your feature requests to:\r\nhttps://firebase.google.com/support/contact/bugs-features/. Select 'Functions' as the 'component'.\r\n\r\n-->\r\n\r\n\r\n### Version info\r\n\r\n<!-- What versions of the following libraries are you using? Note that your issue may already\r\nbe fixed in the latest versions. -->\r\n\r\n**firebase-functions:** 1.0.0\r\n\r\n**firebase-tools:** firebase/firebase-tools.git#ll-fixfbconfig2 (3.18.1) See firebase/firebase-tools/issues/722\r\n\r\n**firebase-admin:** 5.11.0\r\n\r\n### Test case\r\n\r\n<!-- Provide a minimal, complete, and verifiable example (http://stackoverflow.com/help/mcve) -->\r\nSee steps to reproduce. Related to firebase/firebase-functions/issues/216.\r\n\r\n### Steps to reproduce\r\n\r\n<!-- Provide the steps needed to reproduce the issue given the above test case. -->\r\n1. Create a sandbox Firebase project\r\n2. `firebase init functions` (Choose TypeScript and TSLint during setup)\r\n3. `cd functions`\r\n4. Add `\"express\": \"^4.16.3\",` in `package.json`\r\n5. `rm -rf node_modules` then `npm install`\r\n6. Replace `index.ts` with\r\n```ts\r\nimport * as admin from 'firebase-admin';\r\n\r\nadmin.initializeApp();\r\n\r\nexports['debug'] = require(`${__dirname}/debug.js`);\r\n```\r\n7. Create `debug.ts` with\r\n```ts\r\nimport * as express from 'express';\r\nimport * as admin from 'firebase-admin';\r\nimport * as functions from 'firebase-functions';\r\n\r\nconst app = express();\r\n\r\napp.get('/', async (request, response) => {\r\n    try {\r\n        await admin.database().ref().once('value') as admin.database.DataSnapshot;\r\n    } catch (error) {\r\n        console.error(error);\r\n\r\n        return response.status(500).send(error);\r\n    }\r\n\r\n    return response.status(200).send('OK');\r\n});\r\n\r\nexport = functions.https.onRequest((request, response) => {\r\n    // https://github.com/firebase/firebase-functions/issues/27#issuecomment-292768599\r\n\r\n    if (!request.path) {\r\n        request.url = `/${request.url}`;\r\n    }\r\n\r\n    return app(request, response);\r\n});\r\n```\r\n8. `npm run deploy`\r\n9. Access created function URL in a web browser, e.g. `https://us-central1-project-id.cloudfunctions.net/debug`\r\n\r\n### Were you able to successfully deploy your functions?\r\n\r\n<!-- When you ran `firebase deploy`, did you see any error messages? -->\r\nYes.\r\n\r\n### Expected behavior\r\n\r\n<!-- What is the expected behavior? -->\r\n#### HTTP Response\r\n**Status Code:** 200\r\n**Body:** OK\r\n\r\n### Actual behavior\r\n\r\n#### HTTP Response\r\n**Status Code:** 500\r\n**Body:** {\"code\":\"database/invalid-argument\",\"message\":\"Can't determine Firebase Database URL.\"}\r\n\r\n#### Firebase Functions Logs\r\n```sh\r\n{ Error: Can't determine Firebase Database URL.\r\n    at FirebaseDatabaseError.Error (native)\r\n    at FirebaseDatabaseError.FirebaseError [as constructor] (/user_code/node_modules/firebase-admin/lib/utils/error.js:39:28)\r\n    at new FirebaseDatabaseError (/user_code/node_modules/firebase-admin/lib/utils/error.js:190:23)\r\n    at DatabaseService.ensureUrl (/user_code/node_modules/firebase-admin/lib/database/database.js:75:15)\r\n    at DatabaseService.getDatabase (/user_code/node_modules/firebase-admin/lib/database/database.js:52:26)\r\n    at FirebaseApp.database (/user_code/node_modules/firebase-admin/lib/firebase-app.js:235:24)\r\n    at FirebaseNamespace.fn (/user_code/node_modules/firebase-admin/lib/firebase-namespace.js:283:45)\r\n    at Object.<anonymous> (/user_code/lib/debug.js:16:21)\r\n    at next (native)\r\n    at /user_code/lib/debug.js:7:71\r\n  errorInfo: \r\n   { code: 'database/invalid-argument',\r\n     message: 'Can\\'t determine Firebase Database URL.' } }\r\n```"},"comment":{"url":"https://api.github.com/repos/firebase/firebase-functions/issues/comments/406737265","html_url":"https://github.com/firebase/firebase-functions/issues/220#issuecomment-406737265","issue_url":"https://api.github.com/repos/firebase/firebase-functions/issues/220","id":406737265,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjczNzI2NQ==","user":{"login":"PierBover","id":226483,"node_id":"MDQ6VXNlcjIyNjQ4Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/226483?v=4","gravatar_id":"","url":"https://api.github.com/users/PierBover","html_url":"https://github.com/PierBover","followers_url":"https://api.github.com/users/PierBover/followers","following_url":"https://api.github.com/users/PierBover/following{/other_user}","gists_url":"https://api.github.com/users/PierBover/gists{/gist_id}","starred_url":"https://api.github.com/users/PierBover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PierBover/subscriptions","organizations_url":"https://api.github.com/users/PierBover/orgs","repos_url":"https://api.github.com/users/PierBover/repos","events_url":"https://api.github.com/users/PierBover/events{/privacy}","received_events_url":"https://api.github.com/users/PierBover/received_events","type":"User","site_admin":false},"created_at":"2018-07-20T21:58:45Z","updated_at":"2018-07-20T21:58:45Z","author_association":"NONE","body":"I also got the `Can't determine Firebase Database URL` error when using TypeScript.\r\n\r\nI solved it by using @Shery11 's solution:\r\n```\r\nimport * as functions from 'firebase-functions';\r\nimport * as admin from 'firebase-admin';\r\n\r\nadmin.initializeApp(functions.config().firebase);\r\n```\r\n\r\nThis is a fresh project scaffolded today with the CLI. Here are my dependencies:\r\n```\r\n  \"dependencies\": {\r\n    \"firebase-admin\": \"^5.8.2\",\r\n    \"firebase-functions\": \"^0.8.1\"\r\n  },\r\n  \"devDependencies\": {\r\n    \"typescript\": \"^2.5.3\"\r\n  },\r\n```\r\n\r\nWhy is the CLI configuring `0.8.1` instead of `1.1.0` ?"}}
{"actor":{"display_login":"PierBover"}}