timy-messenger icon indicating copy to clipboard operation
timy-messenger copied to clipboard

Functions deploy error

Open praharshbhatt opened this issue 5 years ago • 2 comments

Describe the bug Deploying the firebase functions gives the following errors:

Microsoft Windows [Version 10.0.18362.592]
(c) 2019 Microsoft Corporation. All rights reserved.

D:\Projects\Flutter\Projects\gobeans\firebase\functions>firebase deploy

=== Deploying to 'gobeans-team-messenger'...

i  deploying firestore, functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> functions@ lint D:\Projects\Flutter\Projects\gobeans\firebase\functions
> eslint --max-warnings=0 .


D:\Projects\Flutter\Projects\gobeans\firebase\functions\calendar-update.js
   5:25  error    Use '===' to compare with null                                 no-eq-null
   5:38  error    Expected '!==' and instead saw '!='                            eqeqeq
   6:34  error    Use '===' to compare with null                                 no-eq-null
   6:56  error    Expected '!==' and instead saw '!='                            eqeqeq
  20:56  warning  Expected to return a value at the end of async arrow function  consistent-return
  40:25  error    Use '===' to compare with null                                 no-eq-null
  40:38  error    Expected '!==' and instead saw '!='                            eqeqeq
  41:34  error    Use '===' to compare with null                                 no-eq-null
  41:56  error    Expected '!==' and instead saw '!='                            eqeqeq
  44:9   error    Use '===' to compare with null                                 no-eq-null
  44:21  error    Expected '!==' and instead saw '!='                            eqeqeq
  45:9   error    Use '===' to compare with null                                 no-eq-null
  45:19  error    Expected '!==' and instead saw '!='                            eqeqeq
  47:5   warning  Async arrow function expected no return value                  consistent-return
  73:9   warning  Async arrow function expected no return value                  consistent-return
  77:9   warning  Async arrow function expected no return value                  consistent-return

D:\Projects\Flutter\Projects\gobeans\firebase\functions\channel-edit.js
  24:24  error  Expected '===' and instead saw '=='  eqeqeq
  24:62  error  Expected '===' and instead saw '=='  eqeqeq
  25:26  error  Unexpected `await` inside a loop     no-await-in-loop
  29:17  error  Use '===' to compare with null       no-eq-null
  29:22  error  Expected '!==' and instead saw '!='  eqeqeq
  30:17  error  Unexpected `await` inside a loop     no-await-in-loop
  54:13  error  Use '===' to compare with null       no-eq-null
  54:37  error  Expected '!==' and instead saw '!='  eqeqeq

D:\Projects\Flutter\Projects\gobeans\firebase\functions\channel-new-user.js
  24:47  error  Expected '===' and instead saw '=='  eqeqeq
  50:33  error  Expected '===' and instead saw '=='  eqeqeq
  51:49  error  Expected '===' and instead saw '=='  eqeqeq

D:\Projects\Flutter\Projects\gobeans\firebase\functions\channel-new.js
  14:16  warning  Expected to return a value at the end of async function 'setRsvpGoingForEventCreator'  consistent-return
  42:9   error    Unexpected `await` inside a loop                                                       no-await-in-loop
  42:71  error    Expected '!==' and instead saw '!='                                                    eqeqeq
  51:32  error    Expected '!==' and instead saw '!='                                                    eqeqeq
  67:9   error    Unexpected `await` inside a loop                                                       no-await-in-loop
  79:41  error    Expected '===' and instead saw '=='                                                    eqeqeq

D:\Projects\Flutter\Projects\gobeans\firebase\functions\channel-remove-user.js
  24:13  error  Use '===' to compare with null       no-eq-null
  24:28  error  Expected '===' and instead saw '=='  eqeqeq
  36:51  error  Expected '===' and instead saw '=='  eqeqeq

D:\Projects\Flutter\Projects\gobeans\firebase\functions\cron\event-notify-about-upcoming-event.js
   47:21  error  Unexpected `await` inside a loop     no-await-in-loop
   54:5   error  Unexpected `await` inside a loop     no-await-in-loop
   77:21  error  Expected '===' and instead saw '=='  eqeqeq
   93:9   error  'endFilter' is already defined       no-redeclare
  110:7   error  Unexpected `await` inside a loop     no-await-in-loop
  125:27  error  Unexpected `await` inside a loop     no-await-in-loop
  128:7   error  Unexpected `await` inside a loop     no-await-in-loop
  128:93  error  Expected '===' and instead saw '=='  eqeqeq

D:\Projects\Flutter\Projects\gobeans\firebase\functions\localize-util.js
    8:16  error    Expected '===' and instead saw '=='                      eqeqeq
   16:18  error    Expected '===' and instead saw '=='                      eqeqeq
   18:25  error    Expected '===' and instead saw '=='                      eqeqeq
   29:16  error    Expected '===' and instead saw '=='                      eqeqeq
   37:16  error    Expected '===' and instead saw '=='                      eqeqeq
   38:22  error    Expected '===' and instead saw '=='                      eqeqeq
   40:29  error    Expected '===' and instead saw '=='                      eqeqeq
   46:22  error    Expected '===' and instead saw '=='                      eqeqeq
   48:29  error    Expected '===' and instead saw '=='                      eqeqeq
   63:16  error    Expected '===' and instead saw '=='                      eqeqeq
   97:16  error    Expected '===' and instead saw '=='                      eqeqeq
  110:20  error    Expected '===' and instead saw '=='                      eqeqeq
  115:20  error    Expected '===' and instead saw '=='                      eqeqeq
  134:90  warning  Expected to return a value at the end of arrow function  consistent-return
  136:20  error    Expected '===' and instead saw '=='                      eqeqeq
  142:20  error    Expected '===' and instead saw '=='                      eqeqeq
  149:20  error    Expected '===' and instead saw '=='                      eqeqeq
  150:36  error    Expected '===' and instead saw '=='                      eqeqeq
  152:32  error    Expected '===' and instead saw '=='                      eqeqeq
  166:20  error    Expected '===' and instead saw '=='                      eqeqeq
  181:16  error    Expected '===' and instead saw '=='                      eqeqeq
  193:16  error    Expected '===' and instead saw '=='                      eqeqeq
  213:16  error    Expected '===' and instead saw '=='                      eqeqeq
  222:9   error    Use '===' to compare with null                           no-eq-null
  222:19  error    Expected '===' and instead saw '=='                      eqeqeq
  223:24  error    Expected '===' and instead saw '=='                      eqeqeq
  227:16  error    Expected '===' and instead saw '=='                      eqeqeq
  235:16  error    Expected '===' and instead saw '=='                      eqeqeq
  243:16  error    Expected '===' and instead saw '=='                      eqeqeq
  251:16  error    Expected '===' and instead saw '=='                      eqeqeq
  262:16  error    Expected '===' and instead saw '=='                      eqeqeq

D:\Projects\Flutter\Projects\gobeans\firebase\functions\message-new.js
  26:26  error  Expected '!==' and instead saw '!='  eqeqeq
  44:17  error  Unexpected `await` inside a loop     no-await-in-loop
  45:17  error  Unexpected `await` inside a loop     no-await-in-loop
  46:17  error  Unexpected `await` inside a loop     no-await-in-loop

D:\Projects\Flutter\Projects\gobeans\firebase\functions\push-send.js
   30:32  error  Unexpected `await` inside a loop     no-await-in-loop
   36:37  error  Unexpected `await` inside a loop     no-await-in-loop
   92:50  error  Use '===' to compare with null       no-eq-null
   92:61  error  Expected '!==' and instead saw '!='  eqeqeq
   96:22  error  Use '===' to compare with null       no-eq-null
   96:33  error  Expected '!==' and instead saw '!='  eqeqeq
   96:56  error  Expected '===' and instead saw '=='  eqeqeq
  109:9   error  Use '===' to compare with null       no-eq-null
  109:15  error  Expected '!==' and instead saw '!='  eqeqeq

D:\Projects\Flutter\Projects\gobeans\firebase\functions\reaction-push.js
  22:27  error  Unexpected `await` inside a loop     no-await-in-loop
  32:13  error  Unexpected `await` inside a loop     no-await-in-loop
  40:17  error  Use '===' to compare with null       no-eq-null
  40:23  error  Expected '!==' and instead saw '!='  eqeqeq
  49:17  error  Unexpected `await` inside a loop     no-await-in-loop

D:\Projects\Flutter\Projects\gobeans\firebase\functions\user-util.js
   3:41  warning  Expected to return a value at the end of async arrow function  consistent-return
  13:23  warning  Expected to return a value at the end of arrow function        consistent-return

✖ 95 problems (87 errors, 8 warnings)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `eslint --max-warnings=0 .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2020-01-26T03_42_28_109Z-debug.log
events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: spawn npm --prefix "%RESOURCE_DIR%" run lint ENOENT
    at notFoundError (C:\Users\user\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\Users\user\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
    at ChildProcess.cp.emit (C:\Users\user\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess.cp.emit (C:\Users\user\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) {
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn npm --prefix "%RESOURCE_DIR%" run lint',
  path: 'npm --prefix "%RESOURCE_DIR%" run lint',
  spawnargs: []
}

Error: functions predeploy error: Command terminated with non-zero exit code1

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'Firebase>functions'
  2. Run "firebase deploy"

praharshbhatt avatar Jan 26 '20 03:01 praharshbhatt

I have the same exact error, please any solution for this? I think that all the cloud functions need to be updated

AxesandGrinds avatar Mar 21 '20 15:03 AxesandGrinds

I'm not sure how to upload a folder with the updated files. I updated the files by fixing all the errors and taking out the eslint errors due to awaits in loops. I would advise anyone who gets these errors to go into the functions and fix the errors yourself. most of the errors are simple to replace, i.e. replace == with === and replace != with !==. The rest of the errors are the eslint that can be fixed by placing certain types of comments around the loops in question.

https://stackoverflow.com/questions/48957022/unexpected-await-inside-a-loop-no-await-in-loop

AxesandGrinds avatar Mar 21 '20 16:03 AxesandGrinds