Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy should be able to handle asynchronous operations in modules #775

Closed
AmitMY opened this issue May 20, 2018 · 5 comments
Closed

Deploy should be able to handle asynchronous operations in modules #775

AmitMY opened this issue May 20, 2018 · 5 comments

Comments

@AmitMY
Copy link

AmitMY commented May 20, 2018

Version info

3.18.4

Platform Information

Windows

Steps to reproduce

  • Start a new "project" with functions
  • npm i simple-oauth2@2.0.1
  • In index, add import * as oauth2 from 'simple-oauth2';
  • firebase deploy --only functions

Expected behavior

Should succeed.

Actual behavior

Does 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.

Function load error: Code in file lib/index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: /user_code/node_modules/simple-oauth2/lib/client/auth-code.js:45
async function getToken(params) {
^^^^^^^^

SyntaxError: Unexpected token function
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object. (/user_code/node_modules/simple-oauth2/index.js:4:24)

Should also mention, the tsconfig that was generated is:

{
  "compilerOptions": {
    "lib": ["es6"],
    "module": "commonjs",
    "noImplicitReturns": true,
    "outDir": "lib",
    "sourceMap": true,
    "target": "es6"
  },
  "compileOnSave": true,
  "include": [
    "src"
  ]
}
@mbleigh
Copy link
Contributor

mbleigh commented May 20, 2018 via email

@AmitMY
Copy link
Author

AmitMY commented May 20, 2018

@mbleigh Thanks for the quick & to the point reply.
Is there any workaround that can be done right now, except for asking each library to include an es5 module, or am I stuck with old versions? (This library is used in the functions-samples, but a bit of an older version, that does work with the current firebase deploy)

@merlinnot
Copy link
Contributor

@mbleigh may I ask if you are working on a Node 10 support too? I had an impression that you are not releasing Node 8 because you are waiting for Node 10.

@eduardo-xyz
Copy link

I used 1.6 and it worked.
"simple-oauth2": "^1.6.0"

@tinaliang
Copy link
Contributor

This is now supported with Node 8; we will be closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants