-
Notifications
You must be signed in to change notification settings - Fork 622
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
Comments
node-pre-gyp WARN Using request for node-pre-gyp https download up to date in 7.201s |
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. |
I uninstalled everything node and npm and firebase on my machine and re-installed everything ... and ended up with the same errors. |
Error is due lack of JavaScript files. can't find the notificationHandler.js and getfeed.js files in lib folder to upload. |
The (larger?) issue appears to be with node-pre-gyp ... |
Sorry guys, changed the file structure for cloud functions which messed things up, will look into it |
Changed how I was importing the files, also forgot to add the new js files to git.. Should be good now, lmk |
Thanks for the quick response. ? Do you want to install dependencies with npm now? Yes
node-pre-gyp WARN Using request for node-pre-gyp https download
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o
======== 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] added 449 packages from 473 contributors and audited 4186 packages in 10.548s === Hosting Setup Your public directory is the folder (relative to your project directory) that |
Scotts-Pro-SSD480 [637]> pwd
node-pre-gyp WARN Using request for node-pre-gyp https download audited 4186 packages in 6.308s npm audit fix
node-pre-gyp WARN Using request for node-pre-gyp https download removed 1 package and updated 2 packages in 6.153s |
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.). |
Here's what I did, and was working: New install of Fluttergram Do not overwrite any files Success Please follow those steps and let me know if it works |
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
You're about to initialize a Firebase project in this directory: /NOBACKUP/dart-flutter/fluttergram/functions Before we get started, keep in mind:
? 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. ? Select a default Firebase project for this directory: fluttergramdemo (FluttergramDemo) === Functions Setup A functions directory will be created in your project with a Node.js ? What language would you like to use to write Cloud Functions? TypeScript
node-pre-gyp WARN Using request for node-pre-gyp https download
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o
======== 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] added 423 packages from 461 contributors and audited 4208 packages in 13.527s i Writing configuration info to firebase.json... ✔ Firebase initialization complete! firebase deploy === Deploying to 'fluttergramdemo'... i deploying functions
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
node_modules/firebase-admin/lib/index.d.ts(19,29): error TS2307: Cannot find module '@google-cloud/firestore'. npm ERR! A complete log of this run can be found in: Error: functions predeploy error: Command terminated with non-zero exit code2 |
Looks like the issue is For some reason I get the option to skip the overwrite |
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? |
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. |
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 |
Were you able to fix this? |
I follow the steps that you mentioned and I was able to solve it, thanks! |
@lauramorinigo Which instructions? The instructions in the Readme or something that was said in this thread? |
@mdanics this instructions, I had the same "Error: Error parsing triggers: Cannot find module './notificationHandler'" and after following this it was solved! |
Great, thanks for the confirmation. |
i already uninstall the node.js and use the nvm installer https://github.com/coreybutler/nvm-windows but still got no luck, |
@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 |
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 |
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 |
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? |
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 |
have the same problem, feed only works on profile tab, but not on activity feed nor home tab. Anything else I'm missing? |
@mdanics have the same problem like @aldeecura |
@mediakliq I am having the same issue have you been able to resolve it? |
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. { |
@ramalamadingdong @mediakliq sorry for the late response, didn't see notifications for your comments. I think the issue that @mediakliq is encountering:
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 |
I actually made it so you can now see your own posts with this commit |
Sick Thanks! |
Sorry forgot to mention, you will need to create a new account for it to take action |
Hello, I am following your comments here but unable to get the exact scenario or something else maybe that leading to an error.
because I am unable to run the project. |
I followed the exact steps as mentioned by @mdanics with only exception of removing But still I get Cannot find module './notificationHandler' Please help. |
@mdanics Please what can I do to let the feed works correctly? I can't see posts of accounts that I follow.. |
@mdanics 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 |
|
These steps worked for me however you need to change |
@Farid000 try in your functions\index.js file, change:
to
|
@lauramorinigo did you in doing these steps also do:
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? |
in my case, juse copy /funtions/lib/getFeed.js and /funtions/lib/notificationHandler.js to /functions folder than it works. |
Hi,
Do you know how to solve this issue ? |
did you install " tslint " ? you have to version check or run npm tslint.
and you have to check your node version match with '
fluttergram/functions/package.json ' files
…On Tue, Apr 27, 2021 at 3:06 PM julienfortinfr ***@***.***> wrote:
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 get 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
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHYLIWOMVMO2SR42CZDPKXTTK4DL7ANCNFSM4F75PN5A>
.
|
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. |
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
The text was updated successfully, but these errors were encountered: