{"action":"opened","issue":{"url":"https://api.github.com/repos/firebase/firebase-tools/issues/775","repository_url":"https://api.github.com/repos/firebase/firebase-tools","labels_url":"https://api.github.com/repos/firebase/firebase-tools/issues/775/labels{/name}","comments_url":"https://api.github.com/repos/firebase/firebase-tools/issues/775/comments","events_url":"https://api.github.com/repos/firebase/firebase-tools/issues/775/events","html_url":"https://github.com/firebase/firebase-tools/issues/775","id":324691016,"number":775,"title":"Deploy should be able to handle asynchronous operations in modules","user":{"login":"AmitMY","id":5757359,"avatar_url":"https://avatars1.githubusercontent.com/u/5757359?v=4","gravatar_id":"","url":"https://api.github.com/users/AmitMY","html_url":"https://github.com/AmitMY","followers_url":"https://api.github.com/users/AmitMY/followers","following_url":"https://api.github.com/users/AmitMY/following{/other_user}","gists_url":"https://api.github.com/users/AmitMY/gists{/gist_id}","starred_url":"https://api.github.com/users/AmitMY/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmitMY/subscriptions","organizations_url":"https://api.github.com/users/AmitMY/orgs","repos_url":"https://api.github.com/users/AmitMY/repos","events_url":"https://api.github.com/users/AmitMY/events{/privacy}","received_events_url":"https://api.github.com/users/AmitMY/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-20T07:53:21Z","updated_at":"2018-05-20T07:53:21Z","closed_at":null,"author_association":"NONE","body":"### Version info\r\n3.18.4\r\n### Platform Information\r\nWindows\r\n### Steps to reproduce\r\n- Start a new \"project\" with functions\r\n- `npm i simple-oauth2@2.0.1`\r\n- In index, add `import * as oauth2 from 'simple-oauth2';`\r\n- `firebase deploy --only functions`\r\n### Expected behavior\r\nShould succeed.\r\n\r\n### Actual behavior\r\nDoes not succeed. The `simple-oauth2` library includes `async` functions, which firebase does manage to handle at least for my code. It should be able to handle `async` operations in modules as well.\r\n\r\n> Function load error: Code in file lib/index.js can't be loaded.\r\n> Is there a syntax error in your code?\r\n> Detailed stack trace: /user_code/node_modules/simple-oauth2/lib/client/auth-code.js:45\r\n>   async function getToken(params) {\r\n>         ^^^^^^^^\r\n> \r\n> SyntaxError: Unexpected token function\r\n>     at createScript (vm.js:56:10)\r\n>     at Object.runInThisContext (vm.js:97:10)\r\n>     at Module._compile (module.js:549:28)\r\n>     at Object.Module._extensions..js (module.js:586:10)\r\n>     at Module.load (module.js:494:32)\r\n>     at tryModuleLoad (module.js:453:12)\r\n>     at Function.Module._load (module.js:445:3)\r\n>     at Module.require (module.js:504:17)\r\n>     at require (internal/module.js:20:19)\r\n>     at Object.<anonymous> (/user_code/node_modules/simple-oauth2/index.js:4:24)\r\n\r\n\r\nShould also mention, the `tsconfig` that was generated is:\r\n```json\r\n{\r\n  \"compilerOptions\": {\r\n    \"lib\": [\"es6\"],\r\n    \"module\": \"commonjs\",\r\n    \"noImplicitReturns\": true,\r\n    \"outDir\": \"lib\",\r\n    \"sourceMap\": true,\r\n    \"target\": \"es6\"\r\n  },\r\n  \"compileOnSave\": true,\r\n  \"include\": [\r\n    \"src\"\r\n  ]\r\n}\r\n```\r\n"}}
{"actor":{"display_login":"AmitMY"}}