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

Cloud Functions Setup #25

Closed
ScottYelich opened this issue Oct 29, 2018 · 49 comments
Closed

Cloud Functions Setup #25

ScottYelich opened this issue Oct 29, 2018 · 49 comments

Comments

@ScottYelich
Copy link

Following README.md

firebase deploy --only functions

=== Deploying to 'fluttergramdemo'...

i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...

Error: Error parsing triggers: Cannot find module './notificationHandler'

Try running "npm install" in your functions directory before deploying.


cd functions && npm install
npm WARN [email protected] requires a peer of firebase-admin@~6.0.0 but none is installed. You must install peer dependencies yourself.

audited 4170 packages in 2.042s
found 0 vulnerabilities


firebase deploy --only functions

=== Deploying to 'fluttergramdemo'...

i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...

Error: Error parsing triggers: Cannot find module './notificationHandler'

Try running "npm install" in your functions directory before deploying.

Having trouble? Try firebase deploy --help

@ScottYelich
Copy link
Author

[email protected] install /NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.15.1/node-v67-darwin-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
rm: ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw: No such file or directory
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o] Error 1
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess. (/NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 18.0.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc
node-pre-gyp ERR! node -v v11.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o
../deps/grpc/src/core/lib/backoff/backoff.cc:19:10: fatal error: 'grpc/support/port_platform.h' file not found
#include <grpc/support/port_platform.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.░⸩ ⠸ postinstall: sill doSerial postinstall 572
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram-3/functions/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] requires a peer of firebase-admin@~6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/grpc):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node-pre-gyp install --fallback-to-build --library=static_library
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

up to date in 7.201s
fixed 0 of 0 vulnerabilities in 4170 scanned packages

@ScottYelich
Copy link
Author

ScottYelich commented Oct 29, 2018

This seems like a really interesting project -- but it's very difficult to get working. Is there any way we could share screens or something so you could see all the issues occurring after a fresh clone and initial configuration attempt? There doesn't seem to be a way to contact you other than through issues ... sorry.

@ScottYelich
Copy link
Author

I uninstalled everything node and npm and firebase on my machine and re-installed everything ... and ended up with the same errors.

@harshapulikollu
Copy link
Contributor

Error is due lack of JavaScript files. can't find the notificationHandler.js and getfeed.js files in lib folder to upload.
But we have typescript files in src folder which we can use for cloud functions.

@ScottYelich
Copy link
Author

The (larger?) issue appears to be with node-pre-gyp ...
I'm trying random version combinations (as recommended via google searches) to try to find some combination of versions that work. So far, I haven't had any luck getting node-pre-gyp to compile (and it seems that there are no static libraries available to fetch)

@mdanics
Copy link
Owner

mdanics commented Oct 29, 2018

Sorry guys, changed the file structure for cloud functions which messed things up, will look into it

@mdanics
Copy link
Owner

mdanics commented Oct 29, 2018

Changed how I was importing the files, also forgot to add the new js files to git.. Should be good now, lmk

@ScottYelich
Copy link
Author

Thanks for the quick response.
I just did a fresh clone and received the following after running "firebase init" (selecting all components of firebase -- and javascript (later, not typescript):

? Do you want to install dependencies with npm now? Yes

[email protected] install /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.15.1/node-v67-darwin-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
rm: ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw: No such file or directory
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/11.0.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess. (/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 18.0.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc
node-pre-gyp ERR! node -v v11.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/11.0.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)

[email protected] postinstall /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/protobufjs
node scripts/postinstall

CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o

[email protected] postinstall /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/firebase-functions
node ./upgrade-warning

======== WARNING! ========

This upgrade of firebase-functions contains breaking changes if you are upgrading from a version below v1.0.0.

To see a complete list of these breaking changes, please go to:

https://firebase.google.com/docs/functions/beta-v1-diff

CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/[email protected]
clang: error: no such file or directory: '../deps/grpc/src/core/lib/channel/channel_args.cc'2.8.3
clang: error: no input files
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_args.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/grpc):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node-pre-gyp install --fallback-to-build --library=static_library
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

added 449 packages from 473 contributors and audited 4186 packages in 10.548s
found 16 moderate severity vulnerabilities
run npm audit fix to fix them, or npm audit for details

=== Hosting Setup

Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.

@ScottYelich
Copy link
Author

Scotts-Pro-SSD480 [637]> pwd
/no/dart-flutter/fluttergram-5
Scotts-Pro-SSD480 [638]> cd functions/
Scotts-Pro-SSD480 [639]> cp lib/in
index.js index.js.map
Scotts-Pro-SSD480 [639]> cp lib/index.js .
Scotts-Pro-SSD480 [640]> npm install

[email protected] install /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.15.1/node-v67-darwin-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
rm: ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw: No such file or directory
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o] Error 1
gyp ERR! build error
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/11.0.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess. (/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 18.0.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc
node-pre-gyp ERR! node -v v11.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/11.0.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o
clang: error: no such file or directory: '../deps/grpc/src/core/lib/backoff/backoff.cc'
clang: error: no input files
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] requires a peer of firebase-admin@~6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/grpc):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node-pre-gyp install --fallback-to-build --library=static_library
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

audited 4186 packages in 6.308s
found 16 moderate severity vulnerabilities
run npm audit fix to fix them, or npm audit for details


npm audit fix

[email protected] install /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.15.1/node-v67-darwin-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
rm: ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw: No such file or directory
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o] Error 1
gyp CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/11.0.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess. (/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 18.0.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc
node-pre-gyp ERR! node -v v11.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/11.0.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o1.1.6
clang: error: no such file or directory: '../deps/grpc/src/core/lib/backoff/backoff.cc'
clang: error: no input files
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram-5/functions/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] requires a peer of firebase-admin@~6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/grpc):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node-pre-gyp install --fallback-to-build --library=static_library
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

removed 1 package and updated 2 packages in 6.153s
fixed 16 of 16 vulnerabilities in 4186 scanned packages

@ScottYelich
Copy link
Author

Are you developing on OSX (Mojave?) ... if so, would you be able to do a fresh install of node/npm/firebase -- to see if you get the same results as shown here? I used brew to install npm, then used npm to install all (npm) dependencies (firebase, etc.).

@mdanics
Copy link
Owner

mdanics commented Oct 29, 2018

Here's what I did, and was working:

New install of Fluttergram
git clone https://github.com/mdanics/fluttergram.git
cd fluttergram/functions
firebase init
select cloud functions only
What language would you like to use? -> typescript
Do you want to use TSLint to catch probable bugs and enforce style? -> yes

Do not overwrite any files
File functions/package.json already exists. Overwrite? -> no
File functions/tslint.json already exists. Overwrite? -> no
File functions/tsconfig.json already exists. Overwrite? -> no
File functions/src/index.ts already exists. Overwrite? -> no
Do you want to install dependencies with npm now? -> yes
Do not run npm audit or npm audit fix
firebase deploy

Success

Please follow those steps and let me know if it works

@ScottYelich
Copy link
Author

I think there is some set of dependencies on your system that just makes this work ... for someone with a fresh install and/or on another system -- a clean install (node/npm/firebase/etc) fails:

Scotts-Pro-SSD480 [644]> cd
Scotts-Pro-SSD480 [645]> cd /no/
Scotts-Pro-SSD480 [646]> cd dart-flutter/
Scotts-Pro-SSD480 [647]> git clone https://github.com/mdanics/fluttergram.git
Cloning into 'fluttergram'...
remote: Enumerating objects: 84, done.
remote: Counting objects: 100% (84/84), done.
remote: Compressing objects: 100% (61/61), done.
remote: Total 1306 (delta 32), reused 58 (delta 22), pack-reused 1222
Receiving objects: 100% (1306/1306), 37.12 MiB | 14.14 MiB/s, done.
Resolving deltas: 100% (461/461), done.
Scotts-Pro-SSD480 [648]> cd fluttergram/functions
Scotts-Pro-SSD480 [649]> firebase init

 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥  🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥     🔥🔥🔥     🔥🔥🔥🔥🔥🔥  🔥🔥🔥🔥🔥🔥🔥🔥
 🔥🔥        🔥🔥  🔥🔥     🔥🔥 🔥🔥       🔥🔥     🔥🔥  🔥🔥   🔥🔥  🔥🔥       🔥🔥
 🔥🔥🔥🔥🔥🔥    🔥🔥  🔥🔥🔥🔥🔥🔥🔥🔥  🔥🔥🔥🔥🔥🔥   🔥🔥🔥🔥🔥🔥🔥🔥  🔥🔥🔥🔥🔥🔥🔥🔥🔥  🔥🔥🔥🔥🔥🔥  🔥🔥🔥🔥🔥🔥
 🔥🔥        🔥🔥  🔥🔥    🔥🔥  🔥🔥       🔥🔥     🔥🔥 🔥🔥     🔥🔥       🔥🔥 🔥🔥
 🔥🔥       🔥🔥🔥🔥 🔥🔥     🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥  🔥🔥     🔥🔥  🔥🔥🔥🔥🔥🔥  🔥🔥🔥🔥🔥🔥🔥🔥

You're about to initialize a Firebase project in this directory:

/NOBACKUP/dart-flutter/fluttergram/functions

Before we get started, keep in mind:

  • You are currently outside your home directory

? Which Firebase CLI features do you want to setup for this folder? Press Space to select features, then Enter to confirm your choices. Functions: Configure and deploy Cloud Functions

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.

? Select a default Firebase project for this directory: fluttergramdemo (FluttergramDemo)
i Using project fluttergramdemo (FluttergramDemo)

=== Functions Setup

A functions directory will be created in your project with a Node.js
package pre-configured. Functions can be deployed with firebase deploy.

? What language would you like to use to write Cloud Functions? TypeScript
? Do you want to use TSLint to catch probable bugs and enforce style? Yes
✔ Wrote functions/package.json
✔ Wrote functions/tslint.json
✔ Wrote functions/tsconfig.json
✔ Wrote functions/src/index.ts
✔ Wrote functions/.gitignore
? Do you want to install dependencies with npm now? Yes

[email protected] install /NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.15.1/node-v67-darwin-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
rm: ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw: No such file or directory
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o] Error 1
gyp CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/11.0.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess. (/NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 18.0.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc
node-pre-gyp ERR! node -v v11.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/11.0.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)

[email protected] postinstall /NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/protobufjs
node scripts/postinstall

CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o

[email protected] postinstall /NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/firebase-functions
node ./upgrade-warning

======== WARNING! ========

This upgrade of firebase-functions contains breaking changes if you are upgrading from a version below v1.0.0.

To see a complete list of these breaking changes, please go to:

https://firebase.google.com/docs/functions/beta-v1-diff

CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/[email protected]
error: error reading '../deps/grpc/src/core/lib/channel/channel_args.cc'install: [email protected]
1 error generated.
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_args.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/usr/local/Cellar/node/11.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /NOBACKUP/dart-flutter/fluttergram/functions/functions/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/grpc):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node-pre-gyp install --fallback-to-build --library=static_library
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

added 423 packages from 461 contributors and audited 4208 packages in 13.527s
found 0 vulnerabilities

i Writing configuration info to firebase.json...
i Writing project information to .firebaserc...
i Writing gitignore file to .gitignore...

✔ Firebase initialization complete!


firebase deploy

=== Deploying to 'fluttergramdemo'...

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

functions@ lint /NOBACKUP/dart-flutter/fluttergram/functions/functions
tslint --project tsconfig.json

WARNING: /NOBACKUP/dart-flutter/fluttergram/functions/functions/src/index.ts[1, 1]: 'functions' is declared but its value is never read.

Running command: npm --prefix "$RESOURCE_DIR" run build

functions@ build /NOBACKUP/dart-flutter/fluttergram/functions/functions
tsc

node_modules/firebase-admin/lib/index.d.ts(19,29): error TS2307: Cannot find module '@google-cloud/firestore'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: tsc
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions@ build 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! /users/scottyelich/.npm/_logs/2018-10-29T18_54_22_927Z-debug.log

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

@mdanics
Copy link
Owner

mdanics commented Oct 29, 2018

Looks like the issue is
? Do you want to use TSLint to catch probable bugs and enforce style? Yes
✔ Wrote functions/package.json
✔ Wrote functions/tslint.json
✔ Wrote functions/tsconfig.json
✔ Wrote functions/src/index.ts
✔ Wrote functions/.gitignore
? Do you want to install dependencies with npm now? Yes

For some reason I get the option to skip the overwrite

@mdanics
Copy link
Owner

mdanics commented Oct 29, 2018

Seems like I get the option to skip the overwrite only if i'm choosing a firebase project which i already deployed the functions to. Will look into skipping the overwrite more, but from some googling it doesn't look like theres an option.

Do you know how other projects that use cloud functions do this?

@ScottYelich
Copy link
Author

I'm not sure I understand what this has to do with gyp not being able to compile.

If you are seeing skip due to already having functions deployed -- can you create a new temporary firebase project to test -- and do a clean install of npm/node/firebase/etc and then try to run through the steps of the README?

I am pretty sure that I was able to deploy to this project previously (via another directory).

Basically, I have a project set up in firebase for this "fgd" (for example, but not real name). I was able to previously get the project to compile (remember the http dependency thing?) and I was able to run the project on iOS -- but it never uploaded (always hung, timed out, etc.).

Since the updates to the project, I have not been able to get it to compile again. However, the cloud functions were deployed to the "fgd" project via the first compile and run. When I check out new and run firebase init -- I choose the "fgd" project to work with.

Also, the system really shouldn't depend on clean slate or already-present files to be in a certain state in order to set up / configure, compile and deploy. It should be possible to do those steps whether first checkout/clean(firebase) or git fetch/git merge or even the clean clone but re-use firebase project.

It might be worthwhile to put the steps of the README into a script that performs certain functions (ie: function deploy, URL extraction and source-code modification, etc.). In this way, if other environmental anomalies arise, those might be able to be addressed via the initial config script. Almost like "flutter doctor" for the project.

@mdanics
Copy link
Owner

mdanics commented Oct 30, 2018

I don't have a lot of time on me, and so making a script isn't feasible for me atm.

Hopefully when we sort this out, I will revise the readme instructions to make it more clear.

As per the Cannot find module '@google-cloud/firestore'. in your error, do you have:
https://www.npmjs.com/package/@google-cloud/firestore installed?

@mdanics mdanics changed the title notificationHandler? Cloud Functions Setup Nov 2, 2018
@mdanics
Copy link
Owner

mdanics commented Nov 19, 2018

Were you able to fix this?

@lauramorinigo
Copy link

lauramorinigo commented Nov 20, 2018

I follow the steps that you mentioned and I was able to solve it, thanks!

@mdanics
Copy link
Owner

mdanics commented Nov 21, 2018

@lauramorinigo Which instructions? The instructions in the Readme or something that was said in this thread?

@lauramorinigo
Copy link

Here's what I did, and was working:

New install of Fluttergram
git clone https://github.com/mdanics/fluttergram.git
cd fluttergram/functions
firebase init
select cloud functions only
What language would you like to use? -> typescript
Do you want to use TSLint to catch probable bugs and enforce style? -> yes

Do not overwrite any files
File functions/package.json already exists. Overwrite? -> no
File functions/tslint.json already exists. Overwrite? -> no
File functions/tsconfig.json already exists. Overwrite? -> no
File functions/src/index.ts already exists. Overwrite? -> no
Do you want to install dependencies with npm now? -> yes
Do not run npm audit or npm audit fix
firebase deploy

Success

Please follow those steps and let me know if it works

@mdanics this instructions, I had the same "Error: Error parsing triggers: Cannot find module './notificationHandler'" and after following this it was solved!

@mdanics
Copy link
Owner

mdanics commented Nov 21, 2018

Great, thanks for the confirmation.

@mdanics mdanics closed this as completed Nov 21, 2018
@aldeecura
Copy link

Firebase initialization is successful :)

however when i do the $ firebase deploy --only functions, i got an error, how to fix the path in Windows?

do i need to uninstall the node.js and install again? to which path?
is this a permission issue?

image

@aldeecura
Copy link

i already uninstall the node.js and use the nvm installer https://github.com/coreybutler/nvm-windows

but still got no luck,
error locating the package.json file

@mdanics
Copy link
Owner

mdanics commented Nov 28, 2018

@aldeecura i'm not sure about node.js and path issues on windows sorry. It looks like this is an issue with your node setup rather than fluttergram

@mediakliq
Copy link

mediakliq commented Dec 26, 2018

Hello I followed your instructions and got everything to work except for the feed. Here's the error I'm getting back after I make a post:

5.15.0 - [Firebase/Firestore][I-FST000001] Listen for query at insta_posts failed: The query requires an index. You can create it here: https://console.firebase.google.com/project/fluttagram-2c422/database/firestore/indexes?create_index=EgtpbnN0YV9wb3N0cxoLCgdvd25lcklkEAIaDQoJdGltZXN0YW1wEAIaDAoIX19uYW1lX18QAg

I am seeing in firebase the insta_post being created it's just not showing up in the app I just get a loading spinning graphic.

Thanks

@harshapulikollu
Copy link
Contributor

harshapulikollu commented Dec 27, 2018

click on the link (https://console.firebase.google.com/project/fluttagram-2c422/database/firestore/indexes?create_index=EgtpbnN0YV9wb3N0cxoLCgdvd25lcklkEAIaDQoJdGltZXN0YW1wEAIaDAoIX19uYW1lX18QAg) in your stacktrace . it will take you to your firebase console and there index will be created, then you can able to see your feed in app

@mediakliq
Copy link

mediakliq commented Dec 28, 2018

@harshapulikollu

Thanks yes I did click on the link and was able to create index. The feed now works on the profile only and not on the home feed. Is there another index I need to create?

@harshapulikollu
Copy link
Contributor

Only one index is required according to my knowledge. I'm using only one i.e insta posts. Try to rebuild again it should work

@amizanali
Copy link

@harshapulikollu

Thanks yes I did click on the link and was able to create index. The feed now works on the profile only and not on the home feed. Is there another index I need to create?

have the same problem, feed only works on profile tab, but not on activity feed nor home tab. Anything else I'm missing?

@eagerashwani
Copy link

@mdanics have the same problem like @aldeecura

@ramalamadingdong
Copy link

@mediakliq I am having the same issue have you been able to resolve it?

@vimalvachhani
Copy link

Firebase initialization is successful :)

however when i do the $ firebase deploy --only functions, i got an error, how to fix the path in Windows?

do i need to uninstall the node.js and install again? to which path?
is this a permission issue?

image

Make sure to update firebase.json to the following and run -- sudo npm install tslint typescript -g to make sure tslink is up and running first.

{
"functions": {
"predeploy": [
"npm --prefix "%RESOURCE_DIR%" run lint",
"npm --prefix "%RESOURCE_DIR%" run build"
],
"source": "functions"
}
}

@mdanics
Copy link
Owner

mdanics commented Mar 26, 2019

@ramalamadingdong @mediakliq sorry for the late response, didn't see notifications for your comments.

I think the issue that @mediakliq is encountering:

Thanks yes I did click on the link and was able to create index. The feed now works on the profile only and not on the home feed. Is there another index I need to create?

is due to not following any users with posts. The getFeed function only returns posts from people you follow as to mimic the social media experience, so you will need to create another account and make posts and then follow it with your main account to see items in the feed.

Please let me know if this works! If it doesn't can you make a new issue as this one has gotten off topic/bloated.

Thanks

@mdanics
Copy link
Owner

mdanics commented Apr 2, 2019

I actually made it so you can now see your own posts with this commit

@ramalamadingdong
Copy link

I actually made it so you can now see your own posts with this commit

Sick Thanks!

@mdanics
Copy link
Owner

mdanics commented Apr 2, 2019

Sorry forgot to mention, you will need to create a new account for it to take action

@sumanabhi
Copy link

Hello, I am following your comments here but unable to get the exact scenario or something else maybe that leading to an error.

Here's what I did, and was working:

New install of Fluttergram
git clone https://github.com/mdanics/fluttergram.git
cd fluttergram/functions
firebase init
select cloud functions only
What language would you like to use? -> typescript
Do you want to use TSLint to catch probable bugs and enforce style? -> yes

Do not overwrite any files
File functions/package.json already exists. Overwrite? -> no
File functions/tslint.json already exists. Overwrite? -> no
File functions/tsconfig.json already exists. Overwrite? -> no
File functions/src/index.ts already exists. Overwrite? -> no
Do you want to install dependencies with npm now? -> yes
Do not run npm audit or npm audit fix
firebase deploy

Success

Please follow those steps and let me know if it works

  1. Should we create new functions or just write the code firebase init and then do follow the readme.
    Please check the directory and tell me what I am doing wrong.
Create Cloud Functions (to make the Feed work)
Create a new firebase project with firebase init
Copy this project's functions/lib/index.js to your firebase project's functions/index.js
Push the function getFeed with firebase deploy --only functions In the output, you'll see the getFeed URL, copy that.
Replace the url in the _getFeed function in feed.dart with your cloud function url from the previous step.

because I am unable to run the project.

@casualcoder404
Copy link

firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /Users/omk/AndroidStudioProjects/fluttergram

Before we get started, keep in mind:

  * You are initializing in an existing Firebase project directory

? Which Firebase CLI features do you want to set up for this folder? Press Space to select features, then Enter to confirm yo
ur choices. Functions: Configure and deploy Cloud Functions

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add, 
but for now we'll just set up a default project.

i  .firebaserc already has a default project, using fluttergram-818a6.

=== Functions Setup

A functions directory will be created in your project with a Node.js
package pre-configured. Functions can be deployed with firebase deploy.

? What language would you like to use to write Cloud Functions? TypeScript
? Do you want to use TSLint to catch probable bugs and enforce style? Yes
? File functions/package.json already exists. Overwrite? No
i  Skipping write of functions/package.json
? File functions/tslint.json already exists. Overwrite? No
i  Skipping write of functions/tslint.json
? File functions/tsconfig.json already exists. Overwrite? No
i  Skipping write of functions/tsconfig.json
? File functions/src/index.ts already exists. Overwrite? No
i  Skipping write of functions/src/index.ts
? File functions/.gitignore already exists. Overwrite? No
i  Skipping write of functions/.gitignore
? Do you want to install dependencies with npm now? Yes
audited 1020 packages in 1.869s

26 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...

✔  Firebase initialization complete!
Omkars-MacBook-Pro:functions omk$ firebase deploy

=== Deploying to 'fluttergram-818a6'...

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

> functions@ lint /Users/omk/AndroidStudioProjects/fluttergram/functions
> eslint .


/Users/omk/AndroidStudioProjects/fluttergram/functions/index.js
   9:37  warning  Unexpected function expression  prefer-arrow-callback
  12:77  warning  Unexpected function expression  prefer-arrow-callback

/Users/omk/AndroidStudioProjects/fluttergram/functions/lib/getFeed.js
   3:37  warning  Unexpected function expression  prefer-arrow-callback
   6:77  warning  Unexpected function expression  prefer-arrow-callback
  38:15  warning  Unexpected function expression  prefer-arrow-callback
  40:31  warning  Unexpected function expression  prefer-arrow-callback

/Users/omk/AndroidStudioProjects/fluttergram/functions/lib/index.js
  3:37  warning  Unexpected function expression  prefer-arrow-callback
  6:77  warning  Unexpected function expression  prefer-arrow-callback

/Users/omk/AndroidStudioProjects/fluttergram/functions/lib/notificationHandler.js
  3:37  warning  Unexpected function expression  prefer-arrow-callback
  6:77  warning  Unexpected function expression  prefer-arrow-callback

✖ 10 problems (0 errors, 10 warnings)
  0 errors and 10 warnings potentially fixable with the `--fix` option.

Running command: npm --prefix "$RESOURCE_DIR" run build
npm ERR! missing script: build

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/omk/.npm/_logs/2020-02-26T05_40_35_541Z-debug.log

Error: functions predeploy error: Command terminated with non-zero exit code1
Omkars-MacBook-Pro:functions omk$ firebase deploy

=== Deploying to 'fluttergram-818a6'...

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

> functions@ lint /Users/omk/AndroidStudioProjects/fluttergram/functions
> eslint .


/Users/omk/AndroidStudioProjects/fluttergram/functions/index.js
   9:37  warning  Unexpected function expression  prefer-arrow-callback
  12:77  warning  Unexpected function expression  prefer-arrow-callback

/Users/omk/AndroidStudioProjects/fluttergram/functions/lib/getFeed.js
   3:37  warning  Unexpected function expression  prefer-arrow-callback
   6:77  warning  Unexpected function expression  prefer-arrow-callback
  38:15  warning  Unexpected function expression  prefer-arrow-callback
  40:31  warning  Unexpected function expression  prefer-arrow-callback

/Users/omk/AndroidStudioProjects/fluttergram/functions/lib/index.js
  3:37  warning  Unexpected function expression  prefer-arrow-callback
  6:77  warning  Unexpected function expression  prefer-arrow-callback

/Users/omk/AndroidStudioProjects/fluttergram/functions/lib/notificationHandler.js
  3:37  warning  Unexpected function expression  prefer-arrow-callback
  6:77  warning  Unexpected function expression  prefer-arrow-callback

✖ 10 problems (0 errors, 10 warnings)
  0 errors and 10 warnings potentially fixable with the `--fix` option.

✔  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 parsing triggers: Cannot find module './notificationHandler'
Require stack:
- /Users/omk/AndroidStudioProjects/fluttergram/functions/index.js
- /Users/omk/.nvm/versions/node/v13.9.0/lib/node_modules/firebase-tools/lib/triggerParser.js

Try running "npm install" in your functions directory before deploying.

Having trouble? Try firebase [command] --help
Omkars-MacBook-Pro:functions omk$ 

I followed the exact steps as mentioned by @mdanics with only exception of removing
"npm --prefix "$RESOURCE_DIR" run build" , (which resolves npm --prefix "$RESOURCE_DIR" run lint issue)

But still I get Cannot find module './notificationHandler'

Please help.

@mounagongi
Copy link

mounagongi commented Apr 30, 2020

@mdanics Please what can I do to let the feed works correctly? I can't see posts of accounts that I follow..

@Mugiw4rr4
Copy link

@mdanics
Hi , I don't get the getFeed url , I only get the url of my firebase page , here is what I have in the output of the deployment

PS C:\flutter_projects\fluttergram\functions\functions> firebase deploy --only functions === Deploying to 'staysafe-8efa1'... i deploying functions Running command: npm --prefix "$RESOURCE_DIR" run lint > functions@ lint C:\flutter_projects\fluttergram\functions\functions > tslint --project tsconfig.json Running command: npm --prefix "$RESOURCE_DIR" run build > functions@ build C:\flutter_projects\fluttergram\functions\functions > tsc + functions: Finished running predeploy script. i functions: ensuring required API cloudfunctions.googleapis.com is enabled... + functions: required API cloudfunctions.googleapis.com is enabled i functions: preparing functions directory for uploading... + Deploy complete! Project Console: https://console.firebase.google.com/project/staysafe-8efa1/overview

@GustavoContreiras
Copy link
Contributor

GustavoContreiras commented May 4, 2020

@Mugiw4rr4

@jasdeepj121
Copy link

Here's what I did, and was working:

New install of Fluttergram
git clone https://github.com/mdanics/fluttergram.git
cd fluttergram/functions
firebase init
select cloud functions only
What language would you like to use? -> typescript
Do you want to use TSLint to catch probable bugs and enforce style? -> yes

Do not overwrite any files
File functions/package.json already exists. Overwrite? -> no
File functions/tslint.json already exists. Overwrite? -> no
File functions/tsconfig.json already exists. Overwrite? -> no
File functions/src/index.ts already exists. Overwrite? -> no
Do you want to install dependencies with npm now? -> yes
Do not run npm audit or npm audit fix
firebase deploy

Success

Please follow those steps and let me know if it works

These steps worked for me however you need to change cd fluttergram/functions to cd fluttergram

@Farid000
Copy link

Hello...
I followed the fluttergram instructions...
i deploy function to an existing project..in my firebase console..
error_fluttergram

Please give me solution what i do to remove this error..

@Mateis
Copy link

Mateis commented Jun 30, 2020

@Farid000 try in your functions\index.js file, change:

const notificationHandler_1 = require("./notificationHandler");
const getFeed_1 = require("./getFeed");

to

const notificationHandler_1 = require("./lib/notificationHandler");
const getFeed_1 = require("./lib/getFeed");

@Mateis
Copy link

Mateis commented Jul 5, 2020

Here's what I did, and was working:
New install of Fluttergram
git clone https://github.com/mdanics/fluttergram.git
cd fluttergram/functions
firebase init
select cloud functions only
What language would you like to use? -> typescript
Do you want to use TSLint to catch probable bugs and enforce style? -> yes
Do not overwrite any files
File functions/package.json already exists. Overwrite? -> no
File functions/tslint.json already exists. Overwrite? -> no
File functions/tsconfig.json already exists. Overwrite? -> no
File functions/src/index.ts already exists. Overwrite? -> no
Do you want to install dependencies with npm now? -> yes
Do not run npm audit or npm audit fix
firebase deploy
Success
Please follow those steps and let me know if it works

@mdanics this instructions, I had the same "Error: Error parsing triggers: Cannot find module './notificationHandler'" and after following this it was solved!

@lauramorinigo did you in doing these steps also do:

Copy this project's functions/lib/index.js to your firebase project's functions/index.js

as in the README.md https://github.com/mdanics/fluttergram#3-setup-the-firebase-app or just followed the steps above here in direct sequence?

@lcw99
Copy link
Contributor

lcw99 commented Mar 21, 2021

in my case, juse copy /funtions/lib/getFeed.js and /funtions/lib/notificationHandler.js to /functions folder than it works.

@julienfortinfr
Copy link

julienfortinfr commented Apr 27, 2021

Here's what I did, and was working:

New install of Fluttergram
git clone https://github.com/mdanics/fluttergram.git
cd fluttergram/functions
firebase init
select cloud functions only
What language would you like to use? -> typescript
Do you want to use TSLint to catch probable bugs and enforce style? -> yes

Do not overwrite any files
File functions/package.json already exists. Overwrite? -> no
File functions/tslint.json already exists. Overwrite? -> no
File functions/tsconfig.json already exists. Overwrite? -> no
File functions/src/index.ts already exists. Overwrite? -> no
Do you want to install dependencies with npm now? -> yes
Do not run npm audit or npm audit fix
firebase deploy

Success

Please follow those steps and let me know if it works

Hi,
Thank you for this app. I followed theses steps and it gets me there :

/Users/julienfortin/AndroidStudioProjects/fluttergram/functions/functions/index.js
  1:7  error  'functions' is assigned a value but never used  no-unused-vars

✖ 1 problem (1 error, 0 warnings)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `eslint .`
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!     /Users/julienfortin/.npm/_logs/2021-04-27T19_04_24_648Z-debug.log

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

Do you know how to solve this issue ?
Best regards,
julien

@wikitong
Copy link

wikitong commented Apr 28, 2021 via email

@julienfortinfr
Copy link

julienfortinfr commented Apr 28, 2021

thank you for the input ! installing TSLint worked. I'm know facing the "pay as you go" plan on firebase. I'll go further as soon as I've read the billing conditions.

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