{"action":"opened","issue":{"url":"https://api.github.com/repos/firebase/firebase-admin-node/issues/116","repository_url":"https://api.github.com/repos/firebase/firebase-admin-node","labels_url":"https://api.github.com/repos/firebase/firebase-admin-node/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/firebase/firebase-admin-node/issues/116/comments","events_url":"https://api.github.com/repos/firebase/firebase-admin-node/issues/116/events","html_url":"https://github.com/firebase/firebase-admin-node/issues/116","id":267421083,"number":116,"title":"Invalid database URL causes Node process to get stuck","user":{"login":"pulyaevskiy","id":441756,"avatar_url":"https://avatars2.githubusercontent.com/u/441756?v=4","gravatar_id":"","url":"https://api.github.com/users/pulyaevskiy","html_url":"https://github.com/pulyaevskiy","followers_url":"https://api.github.com/users/pulyaevskiy/followers","following_url":"https://api.github.com/users/pulyaevskiy/following{/other_user}","gists_url":"https://api.github.com/users/pulyaevskiy/gists{/gist_id}","starred_url":"https://api.github.com/users/pulyaevskiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pulyaevskiy/subscriptions","organizations_url":"https://api.github.com/users/pulyaevskiy/orgs","repos_url":"https://api.github.com/users/pulyaevskiy/repos","events_url":"https://api.github.com/users/pulyaevskiy/events{/privacy}","received_events_url":"https://api.github.com/users/pulyaevskiy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-21T23:11:41Z","updated_at":"2017-10-21T23:11:41Z","closed_at":null,"author_association":"NONE","body":"  * Operating System version: macOS 10.12.6 (Sierra)\r\n  * Firebase SDK version: 5.4.2\r\n  * Library version: 5.4.2\r\n  * Firebase Product: database\r\n  * Node version: v8.1.0\r\n\r\n### Invalid database URL causes process to get stuck\r\n\r\n#### Steps to reproduce:\r\n\r\nIf `databaseUrl` is malformed in any way then Node process gets stuck and does nothing. No error is reported and it seems to never timeout.\r\n\r\n#### Relevant Code\r\n\r\nExample to reproduce the issue:\r\n\r\n```js\r\nvar admin = require(\"firebase-admin\");\r\n\r\nvar serviceAccount = require(\"path/to/serviceAccountKey.json\");\r\n\r\nadmin.initializeApp({\r\n  credential: serviceAccount,\r\n  databaseURL: \"“https://your-project-id.firebaseio.com“\" // note extra quotes\r\n});\r\n\r\nvar ref = admin.database().ref(\"/messages/test/uppercase\");\r\n// This Promise never resolves:\r\nref.set('some value').then(function (value) {\r\n    admin.app().delete();\r\n});\r\n```\r\n\r\n### Expected behavior:\r\n\r\n* Validate URL for structure and invalid characters. In my case I had extra quotes around the URL in an environment variable: `export FIREBASE_DATABASE_URL=\"“https://proj-id.firebaseio.com”\"`. However a properly structured URL but wrong URL results in the same behavior, e.g. `https://proj-id.some-other-domain.com`.\r\n* Throw an error after timeout.\r\n* Bonus points: if timeout is configurable."}}
{"actor":{"display_login":"pulyaevskiy"}}