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

issue with predeploy script "npm --prefix \"$RESOURCE_DIR\" run generator" #64

Closed
GorvGoyl opened this issue Feb 6, 2020 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@GorvGoyl
Copy link

GorvGoyl commented Feb 6, 2020

I'm getting below error when trying to deploy functions:

PS C:\Users\1gour\OneDrive\Documents\old\Github\firetable\cloud_functions\functions> firebase deploy --only functions

=== Deploying to 'evrcare-firebase'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run generator

> functions@ generator C:\Users\1gour\OneDrive\Documents\old\Github\firetable\cloud_functions\functions
> cd generator;node index.js

The system cannot find the path specified.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ generator: `cd generator;node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions@ generator 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\1gour\AppData\Roaming\npm-cache\_logs\2020-02-06T17_23_10_050Z-debug.log
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: spawn npm --prefix "%RESOURCE_DIR%" run generator ENOENT
    at notFoundError (C:\Users\1gour\AppData\Roaming\nvm\v8.17.0\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
    at verifyENOENT (C:\Users\1gour\AppData\Roaming\nvm\v8.17.0\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
    at ChildProcess.cp.emit (C:\Users\1gour\AppData\Roaming\nvm\v8.17.0\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:198:12)

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

Having trouble? Try firebase [command] --help

Node: 8.17.0
Platform: Windows 10
Firebase: 7.12.1

Also, I tried deploying functions after removing "npm --prefix "$RESOURCE_DIR" run generator" but then the webapp got stuck at Auth screen. Nothing happens even when I try to authenticate.
image

@shamsmosowi
Copy link
Member

Hi jerry, deploying cloud functions should be fixed now if you pull from master.
Could you share what the error is in browser console for the authentication screen. It might be that the environment variables might not have been configured correctly

@GorvGoyl
Copy link
Author

now, yarn deploy is throwing the below error:

PS C:\Users\1gour\OneDrive\Documents\old\Github\firetable\cloud_functions\functions> yarn deploy
yarn run v1.21.1
$ firebase deploy --only functions

=== Deploying to 'evrcare-firebase'...

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

> functions@ lint C:\Users\1gour\OneDrive\Documents\old\Github\firetable\cloud_functions\functions
> tslint --project tsconfig.json

no-use-before-declare is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
Running command: npm --prefix "$RESOURCE_DIR" run build

> functions@ build C:\Users\1gour\OneDrive\Documents\old\Github\firetable\cloud_functions\functions
> tsc

+  functions: Finished running predeploy script.
i  functions: ensuring necessary APIs are enabled...
+  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...

Error: Error occurred while parsing your function triggers.

TypeError: algolia_1.default is not a function
    at exports.algolia.algoliaConfig_1.default.reduce (C:\Users\1gour\OneDrive\Documents\old\Github\firetable\cloud_functions\functions\lib\index.js:8:88)
    at Array.reduce (<anonymous>)
    at Object.<anonymous> (C:\Users\1gour\OneDrive\Documents\old\Github\firetable\cloud_functions\functions\lib\index.js:7:43)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)

Having trouble? Try firebase [command] --help
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@notsidney
Copy link
Contributor

Hi, I can’t recreate your issue on a clean install. It seems there is an issue with how TypeScript exports the local functions, causing the Firebase CLI to treat a config file as a function to be exported.

Try pulling the latest version of the master branch again and make sure you re-install all dependencies. You should also need to double-check the instructions: Algolia environment keys have been updated with different names. https://github.com/AntlerVC/firetable#4-set-up-cloud-functions

If you’re still facing issues, change the build script in cloud_functions/functions/package.json to be:

"build": "tsc -v",

to print out the version of TypeScript it’s using—maybe that’s the culprit.

Please let us know how it goes.

@notsidney
Copy link
Contributor

@JerryGoyal I was able to recreate your issue. I solved it by deleting the lib folder in cloud_functions/functions, which contains the TypeScript-compiled code.

Please let us know if this works for you too!

@notsidney notsidney added the bug Something isn't working label Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants