Code Monkey home page Code Monkey logo

firestore-social-backend's Introduction

firestore-social-backend built for react-social-network

Getting Started

I recommend read firbase instruction first, then continue installation.

Prerequisites

Install NodeJs

Note

  • If you're using Windows you should install all node-gyp dependencies with following commands:

$ npm install --global --production windows-build-tools and then install the package

$ npm install --global node-gyp

Installing

Install back-end server/serverless

  1. Fork the firestore-social-backend repository on Github
  2. Clone your fork to your local machine
    git clone [email protected]:<yourname>/firestore-social-backend.git
  3. Go to the project root directory
    cd firestore-social-backend
  4. Installing all nodejs modules:
    cd functions && npm install
  5. Configure firebase:
    • In command line of [react-social-network] root project, type firebase login. This command connects your local machine to your Firebase account and grants access to your projects. To test that authentication worked, you can run firebase list to see a list of all of your Firebase projects. The list should be the same as the projects listed at Firebase console.
    • Be sure the name of firebase project for [react-social-network] and this project is same. You also need to check .firebaserc if you set correct project name in default field of projects field.
  6. Set the gmail.email and gmail.password Google Cloud environment variables to match the email and password of the Gmail account used to send emails (or the app password if your account has 2-step verification enabled). The recaptcha.secretKey key is using for recaptcha secret key in SMS verification. The phone.sourceNumber, plivo.authId and plivo.authToken are configuration from Plivo SMS Service in SMS verification .For this use:
    firebase functions:config:set gmail.email="[email protected]" gmail.password="secretpassword" recaptcha.secretkey="secretKey" phone.sourcenumber="sourceNumber" plivo.authid="authId" plivo.authtoken="authToken" setting.appname="App Name"
  7. Deploy ;)
 npm start

firestore-social-backend's People

Contributors

dependabot[bot] avatar drewmcarthur avatar qolzam avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

firestore-social-backend's Issues

Error when running npm start

I followed the steps listed in the medium article, but when I run 'npm start' for this portion of the guide, I get the following:

Starting type checking service...
Using 1 worker with 2048MB memory limit
Hash: ebbae49c4c1b3cbcbce2
Version: webpack 4.30.0
Time: 10033ms
Built at: 04/14/2019 2:07:58 AM
1 asset
Entrypoint main = index.js
[0] external "firebase-functions" 42 bytes {0} [built]
[1] ./src/data/index.ts 210 bytes {0} [built]
[2] ./src/domain/common/index.ts 328 bytes {0} [built]
[3] external "express" 42 bytes {0} [built]
[4] ./src/data/httpStatusCode.ts 3.86 KiB {0} [built]
[5] external "moment" 42 bytes {0} [built]
[6] external "body-parser" 42 bytes {0} [built]
[7] external "request" 42 bytes {0} [built]
[8] external "cookie-parser" 42 bytes {0} [built]
[13] ./src/index.ts 916 bytes {0} [built]
[14] ./src/services/authorize/authorizeService.ts 12.4 KiB {0} [built]
[21] ./src/services/authorize/publicAuthService.ts 11.3 KiB {0} [built]
[23] ./src/services/users/userService.ts 6.08 KiB {0} [built]
[24] ./src/services/common/mailService.ts 1.19 KiB {0} [built]
[25] ./src/services/comments/commentService.ts 3.11 KiB {0} [built]
+ 12 hidden modules

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/

ERROR in ./src/services/authorize/authorizeService.ts
Module not found: Error: Can't resolve '../../domain/authorize/verification' in '/home/tking/work/src/github.com/TylerJKing/firestore-social-backend/functions/src/services/authorize'
@ ./src/services/authorize/authorizeService.ts 18:23-69
@ ./src/index.ts

ERROR in ./src/services/authorize/publicAuthService.ts
Module not found: Error: Can't resolve '../../domain/authorize/verification' in '/home/tking/work/src/github.com/TylerJKing/firestore-social-backend/functions/src/services/authorize'
@ ./src/services/authorize/publicAuthService.ts 17:23-69
@ ./src/index.ts
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: webpack
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! /home/tking/.npm/_logs/2019-04-14T06_07_58_855Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ start: npm run build && firebase deploy
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions@ start 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! /home/tking/.npm/_logs/2019-04-14T06_07_58_904Z-debug.log

TypeError: Cannot read property 'appname' of undefined

after "firebase deploy" this error shows up :

Error: Error occurred while parsing your function triggers.

TypeError: Cannot read property 'appname' of undefined
at Object. (C:\Users\SUBHAM\firestore-social-backend\functions\dist\index.js:1:5536)
at r (C:\Users\SUBHAM\firestore-social-backend\functions\dist\index.js:1:155)
at Object. (C:\Users\SUBHAM\firestore-social-backend\functions\dist\index.js:1:4766)
at r (C:\Users\SUBHAM\firestore-social-backend\functions\dist\index.js:1:155)
at C:\Users\SUBHAM\firestore-social-backend\functions\dist\index.js:1:954
at Object. (C:\Users\SUBHAM\firestore-social-backend\functions\dist\index.js:1:964)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

Error after npm start

Hi, i followed all your installation instructions and when i do npm start in cmd in functions directory i get this error listed below.
Do you know what I need to do to fix it? Thank you!

functions@ start C:\Users\edens\seconde social network\firestore-social-backend\functions
npm run build && firebase deploy

functions@ build C:\Users\edens\seconde social network\firestore-social-backend\functions
webpack

Starting type checking service...
Using 1 worker with 2048MB memory limit
Hash: b571d372100659d5c07d
Version: webpack 4.42.1
Time: 4741ms
Built at: 2020-03-25 11:24:59
Asset Size Chunks Chunk Names
index.js 21.6 KiB 0 [emitted] main
Entrypoint main = index.js
[0] external "firebase-functions" 42 bytes {0} [built]
[1] ./src/data/index.ts 215 bytes {0} [built]
[2] ./src/domain/common/index.ts 336 bytes {0} [built]
[3] external "express" 42 bytes {0} [built]
[4] ./src/data/httpStatusCode.ts 3.91 KiB {0} [built]
[5] external "moment" 42 bytes {0} [built]
[6] external "body-parser" 42 bytes {0} [built]
[7] ./src/domain/authorize/verification.ts 488 bytes {0} [built]
[8] external "request" 42 bytes {0} [built]
[14] ./src/index.ts 943 bytes {0} [built]
[15] ./src/services/authorize/authorizeService.ts 12.7 KiB {0} [built]
[22] ./src/services/authorize/publicAuthService.ts 11.6 KiB {0} [built]
[24] ./src/services/users/userService.ts 6.2 KiB {0} [built]
[25] ./src/services/common/mailService.ts 1.22 KiB {0} [built]
[26] ./src/services/comments/commentService.ts 3.18 KiB {0} [built]
+ 13 hidden modules

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

ERROR in C:/Users/edens/seconde social network/firestore-social-backend/functions/node_modules/firebase-functions/lib/apps.d.ts
ERROR in C:/Users/edens/seconde social network/firestore-social-backend/functions/node_modules/firebase-functions/lib/apps.d.ts(7,44):
TS2304: Cannot find name 'unknown'.

ERROR in C:/Users/edens/seconde social network/firestore-social-backend/functions/node_modules/firebase-functions/lib/apps.d.ts
ERROR in C:/Users/edens/seconde social network/firestore-social-backend/functions/node_modules/firebase-functions/lib/apps.d.ts(26,13):
TS1086: An accessor cannot be declared in an ambient context.

ERROR in C:/Users/edens/seconde social network/firestore-social-backend/functions/node_modules/firebase-functions/lib/providers/pubsub.d.ts
ERROR in C:/Users/edens/seconde social network/firestore-social-backend/functions/node_modules/firebase-functions/lib/providers/pubsub.d.ts(71,9):
TS1086: An accessor cannot be declared in an ambient context.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: webpack
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! C:\Users\edens\AppData\Roaming\npm-cache_logs\2020-03-25T09_24_59_615Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ start: npm run build && firebase deploy
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions@ start 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\edens\AppData\Roaming\npm-cache_logs\2020-03-25T09_24_59_668Z-debug.log

npm install fails with a exit code 1

gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:345:16)
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 Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=C:\TestProject\firestore-social-backend\functions\node_modules\grpc\src\node\extension_binary\node-v67-win32-x64-unknown\grpc_node.node" "--module_name=grpc_node" "--module_path=C:\TestProject\firestore-social-backend\functions\node_modules\grpc\src\node\extension_binary\node-v67-win32-x64-unknown" "--napi_version=3" "--node_abi_napi=napi" "--python=c:\Python\27\python.exe"
gyp ERR! cwd C:\TestProject\firestore-social-backend\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 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\TestProject\firestore-social-backend\functions\node_modules\grpc\src\node\extension_binary\node-v67-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\TestProject\firestore-social-backend\functions\node_modules\grpc\src\node\extension_binary\node-v67-win32-x64-unknown --napi_version=3 --node_abi_napi=napi --python=c:\Python\27\python.exe' (1)
node-pre-gyp ERR! stack at ChildProcess. (C:\TestProject\firestore-social-backend\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 Windows_NT 10.0.17134
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\TestProject\firestore-social-backend\functions\node_modules\grpc\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd C:\TestProject\firestore-social-backend\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 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=C:\TestProject\firestore-social-backend\functions\node_modules\grpc\src\node\extension_binary\node-v67-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\TestProject\firestore-social-backend\functions\node_modules\grpc\src\node\extension_binary\node-v67-win32-x64-unknown --napi_version=3 --node_abi_napi=napi --python=c:\Python\27\python.exe' (1)
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of firebase-admin@~5.12.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build --library=static_library
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install 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\akarumuru\AppData\Roaming\npm-cache_logs\2018-10-31T18_23_27_928Z-debug.log

What am i missing?
I Searched different blog posts, seems to be a common issue but none of the solutions worked for me.
Need some help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.