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

Speakers, Schedule, Blog and Team sections won't work #1373

Closed
zptoth opened this issue Oct 1, 2020 · 17 comments
Closed

Speakers, Schedule, Blog and Team sections won't work #1373

zptoth opened this issue Oct 1, 2020 · 17 comments

Comments

@zptoth
Copy link

zptoth commented Oct 1, 2020

Hi,

Speakers, Schedule, Blog and Team sections won't work for me some reason. They just load and load but the content won't show up.

Here is what I do.

  • Create GCP project
  • Create and link Firebase project to GCP project
  • Enable App Engine in GCP
  • Create a Web app in Firebase
  • Enable Hosting in Firebase
  • Enable Firestore in Firebase
  • Enable Storage in Firebase
  • Clone the source code to local
  • Update config files config/development.json and config/production.json with Firebase config data
  • Login to Firebase from CLI
  • Select the right project from CLI
  • sudo npm install -g firebase-tools
  • npm install
  • npm run build
  • firebase deploy

The test site is here: https://df-hu-dev.web.app/

Content won't show up for these pages:

Do I miss any important step?

Thanks,


update:

This is how I started, then I realized that there were two similar projects with slightly different documentations:

  1. https://github.com/GDG-Ukraine/hoverboard-devfest-ukraine/tree/master/docs
  2. https://github.com/gdg-x/hoverboard/tree/main/docs

So I have returned to the gdg-x one.
My step by step description above is not fully valid anymore as previously I have missed the 'serviceAccount.json' and 'npm run firestore:init' steps.

Now, at 'npm run firestore:init' I am experiencing the same as described here: #1374

@cortinico
Copy link
Contributor

The test site is here: df-hu-dev.web.app

Seems like the site is not deployed at all.

Can you post the output of this command:

firebase deploy

@zptoth
Copy link
Author

zptoth commented Oct 1, 2020

The output of firebase deploy is the following:

=== Deploying to 'df-hu-dev'...

i  deploying storage, firestore, functions, hosting
Running command: npm --prefix "$RESOURCE_DIR" run build

> hoverboard-functions@ prebuild /home/zptoth/dev/df_hu/git/hoverboard/functions
> rimraf dist


> hoverboard-functions@ build /home/zptoth/dev/df_hu/git/hoverboard/functions
> tsc


> hoverboard-functions@ postbuild /home/zptoth/dev/df_hu/git/hoverboard/functions
> cpx ../dist/index.html dist/

✔  functions: Finished running predeploy script.
i  firebase.storage: checking storage.rules for compilation errors...
✔  firebase.storage: rules file storage.rules compiled successfully
i  firestore: reading indexes from firestore.indexes.json...
i  cloud.firestore: checking firestore.rules for compilation errors...
✔  cloud.firestore: rules file firestore.rules compiled successfully
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  storage: latest version of storage.rules already up to date, skipping upload...
✔  firestore: deployed indexes in firestore.indexes.json successfully
i  firestore: latest version of firestore.rules already up to date, skipping upload...
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (74.77 KB) for uploading
✔  functions: functions folder uploaded successfully
i  hosting[df-hu-dev]: beginning deploy...
i  hosting[df-hu-dev]: found 132 files in dist
✔  hosting[df-hu-dev]: file upload complete
✔  storage: released rules storage.rules to firebase.storage
✔  firestore: released rules firestore.rules to cloud.firestore
i  functions: updating Node.js 12 function saveUserData(us-central1)...
i  functions: updating Node.js 12 function sendGeneralNotification(us-central1)...
i  functions: updating Node.js 12 function scheduleNotifications(us-central1)...
i  functions: updating Node.js 12 function optimizeImages(us-central1)...
i  functions: updating Node.js 12 function mailchimpSubscribe(us-central1)...
i  functions: updating Node.js 12 function prerender(us-central1)...
i  functions: updating Node.js 12 function scheduleWrite(us-central1)...
i  functions: updating Node.js 12 function sessionsWrite(us-central1)...
i  functions: updating Node.js 12 function speakersWrite(us-central1)...
i  scheduler: ensuring required API cloudscheduler.googleapis.com is enabled...
i  pubsub: ensuring required API pubsub.googleapis.com is enabled...
✔  scheduler: required API cloudscheduler.googleapis.com is enabled
✔  pubsub: required API pubsub.googleapis.com is enabled
i  functions: scheduler job firebase-schedule-scheduleNotifications-us-central1 is up to date, no changes required
✔  functions[saveUserData(us-central1)]: Successful update operation. 
✔  functions[sessionsWrite(us-central1)]: Successful update operation. 
✔  functions[scheduleNotifications(us-central1)]: Successful update operation. 
✔  functions[prerender(us-central1)]: Successful update operation. 
✔  functions[mailchimpSubscribe(us-central1)]: Successful update operation. 
✔  functions[scheduleWrite(us-central1)]: Successful update operation. 
✔  functions[speakersWrite(us-central1)]: Successful update operation. 
✔  functions[optimizeImages(us-central1)]: Successful update operation. 
✔  functions[sendGeneralNotification(us-central1)]: Successful update operation. 
i  hosting[df-hu-dev]: finalizing version...
✔  hosting[df-hu-dev]: version finalized
i  hosting[df-hu-dev]: releasing new version...
✔  hosting[df-hu-dev]: release complete

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/df-hu-dev/overview
Hosting URL: `https://df-hu-dev.web.app

@zptoth
Copy link
Author

zptoth commented Oct 1, 2020

The strage thing is that for 'npm run firestore:init' I receive the following error:

$ npm run firestore:init

> hoverboard@3.0.0 firestore:init /home/xxx/dev/df_hu/git/hoverboard
> firebase firestore:delete -r --all-collections -y && firebase functions:config:set schedule.enabled=true && firebase deploy --except hosting && babel-node ./internals/import-default-data

Deleting the following collections: 
✔  Functions config updated.

Please deploy your functions for the change to take effect by running firebase deploy --only functions


=== Deploying to 'df-hu-dev'...

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

> hoverboard-functions@ prebuild /home/xxx/dev/df_hu/git/hoverboard/functions
> rimraf dist


> hoverboard-functions@ build /home/xxx/dev/df_hu/git/hoverboard/functions
> tsc


> hoverboard-functions@ postbuild /home/xxx/dev/df_hu/git/hoverboard/functions
> cpx ../dist/index.html dist/

✔  functions: Finished running predeploy script.
i  firebase.storage: checking storage.rules for compilation errors...
✔  firebase.storage: rules file storage.rules compiled successfully
i  firestore: reading indexes from firestore.indexes.json...
i  cloud.firestore: checking firestore.rules for compilation errors...
✔  cloud.firestore: rules file firestore.rules compiled successfully
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
i  storage: latest version of storage.rules already up to date, skipping upload...
✔  firestore: deployed indexes in firestore.indexes.json successfully
i  firestore: latest version of firestore.rules already up to date, skipping upload...
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (72.36 KB) for uploading
✔  functions: functions folder uploaded successfully
✔  storage: released rules storage.rules to firebase.storage
✔  firestore: released rules firestore.rules to cloud.firestore
i  functions: updating Node.js 12 function saveUserData(us-central1)...
i  functions: updating Node.js 12 function sendGeneralNotification(us-central1)...
i  functions: updating Node.js 12 function scheduleNotifications(us-central1)...
i  functions: updating Node.js 12 function optimizeImages(us-central1)...
i  functions: updating Node.js 12 function mailchimpSubscribe(us-central1)...
i  functions: updating Node.js 12 function prerender(us-central1)...
i  functions: updating Node.js 12 function scheduleWrite(us-central1)...
i  functions: updating Node.js 12 function sessionsWrite(us-central1)...
i  functions: updating Node.js 12 function speakersWrite(us-central1)...
i  scheduler: ensuring required API cloudscheduler.googleapis.com is enabled...
i  pubsub: ensuring required API pubsub.googleapis.com is enabled...
✔  pubsub: required API pubsub.googleapis.com is enabled
✔  scheduler: required API cloudscheduler.googleapis.com is enabled
i  functions: scheduler job firebase-schedule-scheduleNotifications-us-central1 is up to date, no changes required
✔  functions[mailchimpSubscribe(us-central1)]: Successful update operation. 
✔  functions[saveUserData(us-central1)]: Successful update operation. 
✔  functions[sendGeneralNotification(us-central1)]: Successful update operation. 
✔  functions[sessionsWrite(us-central1)]: Successful update operation. 
✔  functions[scheduleWrite(us-central1)]: Successful update operation. 
✔  functions[scheduleNotifications(us-central1)]: Successful update operation. 
✔  functions[prerender(us-central1)]: Successful update operation. 
✔  functions[speakersWrite(us-central1)]: Successful update operation. 
✔  functions[optimizeImages(us-central1)]: Successful update operation. 

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/df-hu-dev/overview
sh: 1: babel-node: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! hoverboard@3.0.0 firestore:init: `firebase firestore:delete -r --all-collections -y && firebase functions:config:set schedule.enabled=true && firebase deploy --except hosting && babel-node ./internals/import-default-data`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the hoverboard@3.0.0 firestore:init 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/xxx/.npm/_logs/2020-10-01T20_07_55_357Z-debug.log

@zptoth
Copy link
Author

zptoth commented Oct 1, 2020

However if I install babel-node and do an 'npm audit fix' there is another error:

$ npm install --save-dev @babel/node
npm WARN @typescript-eslint/eslint-plugin@2.34.0 requires a peer of eslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@2.34.0 requires a peer of eslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-esnext@4.0.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-node@4.0.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-native@4.0.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-recommended@4.0.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react@7.13.0 requires a peer of eslint@^3.0.0 || ^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react-native@3.7.0 requires a peer of eslint@^3.17.0 || ^4 || ^5 but none is installed. You must install peer dependencies yourself.

+ @babel/node@7.10.5
added 24 packages from 18 contributors, updated 3 packages and audited 2873 packages in 14.806s

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

found 35 vulnerabilities (30 low, 1 moderate, 4 high)
  run `npm audit fix` to fix them, or `npm audit` for details

$ npm audit fix
npm WARN @typescript-eslint/eslint-plugin@2.34.0 requires a peer of eslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@2.34.0 requires a peer of eslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-esnext@4.0.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-node@4.0.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-native@4.0.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-recommended@4.0.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react@7.13.0 requires a peer of eslint@^3.0.0 || ^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react-native@3.7.0 requires a peer of eslint@^3.17.0 || ^4 || ^5 but none is installed. You must install peer dependencies yourself.

updated 1 package in 7.819s

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

fixed 27 of 35 vulnerabilities in 2873 scanned packages
  8 vulnerabilities required manual review and could not be updated

$ npm run firestore:init

> hoverboard@3.0.0 firestore:init /home/xxx/dev/df_hu/git/hoverboard
> firebase firestore:delete -r --all-collections -y && firebase functions:config:set schedule.enabled=true && firebase deploy --except hosting && babel-node ./internals/import-default-data

Deleting the following collections: 
✔  Functions config updated.

Please deploy your functions for the change to take effect by running firebase deploy --only functions


=== Deploying to 'df-hu-dev'...

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

> hoverboard-functions@ prebuild /home/xxx/dev/df_hu/git/hoverboard/functions
> rimraf dist


> hoverboard-functions@ build /home/xxx/dev/df_hu/git/hoverboard/functions
> tsc


> hoverboard-functions@ postbuild /home/xxx/dev/df_hu/git/hoverboard/functions
> cpx ../dist/index.html dist/

✔  functions: Finished running predeploy script.
i  firebase.storage: checking storage.rules for compilation errors...
✔  firebase.storage: rules file storage.rules compiled successfully
i  firestore: reading indexes from firestore.indexes.json...
i  cloud.firestore: checking firestore.rules for compilation errors...
✔  cloud.firestore: rules file firestore.rules compiled successfully
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  storage: latest version of storage.rules already up to date, skipping upload...
✔  firestore: deployed indexes in firestore.indexes.json successfully
i  firestore: latest version of firestore.rules already up to date, skipping upload...
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (72.36 KB) for uploading
✔  functions: functions folder uploaded successfully
✔  storage: released rules storage.rules to firebase.storage
✔  firestore: released rules firestore.rules to cloud.firestore
i  functions: updating Node.js 12 function saveUserData(us-central1)...
i  functions: updating Node.js 12 function sendGeneralNotification(us-central1)...
i  functions: updating Node.js 12 function scheduleNotifications(us-central1)...
i  functions: updating Node.js 12 function optimizeImages(us-central1)...
i  functions: updating Node.js 12 function mailchimpSubscribe(us-central1)...
i  functions: updating Node.js 12 function prerender(us-central1)...
i  functions: updating Node.js 12 function scheduleWrite(us-central1)...
i  functions: updating Node.js 12 function sessionsWrite(us-central1)...
i  functions: updating Node.js 12 function speakersWrite(us-central1)...
i  scheduler: ensuring required API cloudscheduler.googleapis.com is enabled...
i  pubsub: ensuring required API pubsub.googleapis.com is enabled...
✔  scheduler: required API cloudscheduler.googleapis.com is enabled
✔  pubsub: required API pubsub.googleapis.com is enabled
i  functions: scheduler job firebase-schedule-scheduleNotifications-us-central1 is up to date, no changes required
✔  functions[scheduleWrite(us-central1)]: Successful update operation. 
✔  functions[optimizeImages(us-central1)]: Successful update operation. 
✔  functions[speakersWrite(us-central1)]: Successful update operation. 
✔  functions[scheduleNotifications(us-central1)]: Successful update operation. 
✔  functions[sendGeneralNotification(us-central1)]: Successful update operation. 
✔  functions[prerender(us-central1)]: Successful update operation. 
✔  functions[mailchimpSubscribe(us-central1)]: Successful update operation. 
✔  functions[sessionsWrite(us-central1)]: Successful update operation. 
✔  functions[saveUserData(us-central1)]: Successful update operation. 

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/df-hu-dev/overview
(node:7343) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
/home/xxx/dev/df_hu/git/hoverboard/internals/import-default-data.js:1
import { initializeFirebase, firestore } from './firebase-config';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:1053:16)
    at Module._compile (internal/modules/cjs/loader.js:1101:27)
    at Module._compile (/home/xxx/dev/df_hu/git/hoverboard/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Object.newLoader [as .js] (/home/xxx/dev/df_hu/git/hoverboard/node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at Object.<anonymous> (/home/xxx/dev/df_hu/git/hoverboard/node_modules/@babel/node/lib/_babel-node.js:180:21)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hoverboard@3.0.0 firestore:init: `firebase firestore:delete -r --all-collections -y && firebase functions:config:set schedule.enabled=true && firebase deploy --except hosting && babel-node ./internals/import-default-data`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the hoverboard@3.0.0 firestore:init 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/xxx/.npm/_logs/2020-10-01T20_12_13_646Z-debug.log

@zptoth
Copy link
Author

zptoth commented Oct 1, 2020

And if I try to follow the recommended solutions from the error output it just gets worse and worse. Rename, edit file, etc. one after another.

@abraham
Copy link
Member

abraham commented Oct 2, 2020

It looks like there isn't any data to display. The init command should be fixed now, give that a try and see if data will render.

@zptoth
Copy link
Author

zptoth commented Oct 2, 2020

Thanks. Getting better, but still won't init.

xxx@debian:~/dev/df_hu/git$ cd hoverboard/

xxx@debian:~/dev/df_hu/git/hoverboard$ npm ci

> core-js@3.6.5 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> protobufjs@6.10.1 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/protobufjs
> node scripts/postinstall


> core-js-pure@3.6.5 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@2.6.11 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/wait-on/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> re2@1.15.4 install /home/xxx/dev/df_hu/git/hoverboard/node_modules/re2
> install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR

Trying https://github.com/uhop/node-re2/releases/download/1.15.4/linux-x64-72.br ...
Writing to build/Release/re2.node ...
Done.

> core-js-bundle@3.6.5 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/core-js-bundle
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@2.6.11 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> ejs@2.7.4 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)


> hoverboard@3.0.0 postinstall /home/xxx/dev/df_hu/git/hoverboard
> npm run install:functions && npm run install:emulator


> hoverboard@3.0.0 install:functions /home/xxx/dev/df_hu/git/hoverboard
> npm --prefix ./functions ci


> protobufjs@6.10.1 postinstall /home/xxx/dev/df_hu/git/hoverboard/functions/node_modules/protobufjs
> node scripts/postinstall


> fsevents@1.2.11 install /home/xxx/dev/df_hu/git/hoverboard/functions/node_modules/fsevents
> node-gyp rebuild

make: Entering directory '/home/xxx/dev/df_hu/git/hoverboard/functions/node_modules/fsevents/build'
  SOLINK_MODULE(target) Release/obj.target/.node
  COPY Release/.node
make: Leaving directory '/home/xxx/dev/df_hu/git/hoverboard/functions/node_modules/fsevents/build'
added 352 packages in 2.066s

> hoverboard@3.0.0 install:emulator /home/xxx/dev/df_hu/git/hoverboard
> firebase setup:emulators:firestore

i  firestore: downloading cloud-firestore-emulator-v1.11.7.jar...
Progress: =========================================================================================================================================================================================> (100% of 64MB)
added 2844 packages in 23.686s

xxx@debian:~/dev/df_hu/git/hoverboard$ npx firebase use df-hu-dev
Now using project df-hu-dev

xxx@debian:~/dev/df_hu/git/hoverboard$ npx firebase firestore:delete --recursive --all-collections
? You are about to delete THE ENTIRE DATABASE for df-hu-dev. Are you sure? Yes
Deleting the following collections: 

xxx@debian:~/dev/df_hu/git/hoverboard$ npm run firestore:init

> hoverboard@3.0.0 firestore:init /home/xxx/dev/df_hu/git/hoverboard
> firebase functions:config:set schedule.enabled=true && firebase deploy --except hosting && ts-node ./internals/import-default-data

✔  Functions config updated.

Please deploy your functions for the change to take effect by running firebase deploy --only functions


=== Deploying to 'df-hu-dev'...

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

> hoverboard-functions@ prebuild /home/xxx/dev/df_hu/git/hoverboard/functions
> rimraf dist


> hoverboard-functions@ build /home/xxx/dev/df_hu/git/hoverboard/functions
> tsc


> hoverboard-functions@ postbuild /home/xxx/dev/df_hu/git/hoverboard/functions
> cpx ../dist/index.html dist/

✔  functions: Finished running predeploy script.
i  firebase.storage: checking storage.rules for compilation errors...
✔  firebase.storage: rules file storage.rules compiled successfully
i  firestore: reading indexes from firestore.indexes.json...
i  cloud.firestore: checking firestore.rules for compilation errors...
✔  cloud.firestore: rules file firestore.rules compiled successfully
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
i  storage: latest version of storage.rules already up to date, skipping upload...
✔  firestore: deployed indexes in firestore.indexes.json successfully
i  firestore: latest version of firestore.rules already up to date, skipping upload...
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (72.36 KB) for uploading
✔  functions: functions folder uploaded successfully
✔  storage: released rules storage.rules to firebase.storage
✔  firestore: released rules firestore.rules to cloud.firestore
i  functions: updating Node.js 12 function saveUserData(us-central1)...
i  functions: updating Node.js 12 function sendGeneralNotification(us-central1)...
i  functions: updating Node.js 12 function scheduleNotifications(us-central1)...
i  functions: updating Node.js 12 function optimizeImages(us-central1)...
i  functions: updating Node.js 12 function mailchimpSubscribe(us-central1)...
i  functions: updating Node.js 12 function prerender(us-central1)...
i  functions: updating Node.js 12 function scheduleWrite(us-central1)...
i  functions: updating Node.js 12 function sessionsWrite(us-central1)...
i  functions: updating Node.js 12 function speakersWrite(us-central1)...
i  scheduler: ensuring required API cloudscheduler.googleapis.com is enabled...
i  pubsub: ensuring required API pubsub.googleapis.com is enabled...
✔  scheduler: required API cloudscheduler.googleapis.com is enabled
✔  pubsub: required API pubsub.googleapis.com is enabled
i  functions: scheduler job firebase-schedule-scheduleNotifications-us-central1 is up to date, no changes required
✔  functions[speakersWrite(us-central1)]: Successful update operation. 
✔  functions[prerender(us-central1)]: Successful update operation. 
✔  functions[mailchimpSubscribe(us-central1)]: Successful update operation. 
✔  functions[scheduleNotifications(us-central1)]: Successful update operation. 
✔  functions[sendGeneralNotification(us-central1)]: Successful update operation. 
✔  functions[optimizeImages(us-central1)]: Successful update operation. 
✔  functions[saveUserData(us-central1)]: Successful update operation. 
✔  functions[scheduleWrite(us-central1)]: Successful update operation. 
✔  functions[sessionsWrite(us-central1)]: Successful update operation. 

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/df-hu-dev/overview
(node:17364) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
/home/xxx/dev/df_hu/git/hoverboard/internals/import-default-data.ts:1
import { importBlog, importGallery, importNotificationsConfig, importPartners, importPreviousSpeakers, importSchedule, importSessions, importSpeakers, importTeam, importTickets, importVideos, } from './import-default-data-utils';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:1053:16)
    at Module._compile (internal/modules/cjs/loader.js:1101:27)
    at Module.m._compile (/home/xxx/dev/df_hu/git/hoverboard/node_modules/ts-node/src/index.ts:1043:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Object.require.extensions.<computed> [as .ts] (/home/xxx/dev/df_hu/git/hoverboard/node_modules/ts-node/src/index.ts:1046:12)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at main (/home/xxx/dev/df_hu/git/hoverboard/node_modules/ts-node/src/bin.ts:225:14)
    at Object.<anonymous> (/home/xxx/dev/df_hu/git/hoverboard/node_modules/ts-node/src/bin.ts:512:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hoverboard@3.0.0 firestore:init: `firebase functions:config:set schedule.enabled=true && firebase deploy --except hosting && ts-node ./internals/import-default-data`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the hoverboard@3.0.0 firestore:init 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/xxx/.npm/_logs/2020-10-02T06_09_29_920Z-debug.log

@abraham
Copy link
Member

abraham commented Oct 2, 2020

What version of Node.js are you using?

@abraham
Copy link
Member

abraham commented Oct 2, 2020

Give it another try.

@zptoth
Copy link
Author

zptoth commented Oct 2, 2020

Now it works, I can confirm. Thanks!

$ npx firebase use df-hu-dev
Now using project df-hu-dev

xxx@debian:~/dev/df_hu/git/hoverboard$ npm ci

> core-js@3.6.5 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> protobufjs@6.10.1 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/protobufjs
> node scripts/postinstall


> core-js-pure@3.6.5 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@2.6.11 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/wait-on/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> re2@1.15.4 install /home/xxx/dev/df_hu/git/hoverboard/node_modules/re2
> install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR

Trying https://github.com/uhop/node-re2/releases/download/1.15.4/linux-x64-72.br ...
Writing to build/Release/re2.node ...
Done.

> core-js-bundle@3.6.5 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/core-js-bundle
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@2.6.11 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> ejs@2.7.4 postinstall /home/xxx/dev/df_hu/git/hoverboard/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)


> hoverboard@3.0.0 postinstall /home/xxx/dev/df_hu/git/hoverboard
> npm run install:functions && npm run install:emulator


> hoverboard@3.0.0 install:functions /home/xxx/dev/df_hu/git/hoverboard
> npm --prefix ./functions ci


> protobufjs@6.10.1 postinstall /home/xxx/dev/df_hu/git/hoverboard/functions/node_modules/protobufjs
> node scripts/postinstall


> fsevents@1.2.11 install /home/xxx/dev/df_hu/git/hoverboard/functions/node_modules/fsevents
> node-gyp rebuild

make: Entering directory '/home/xxx/dev/df_hu/git/hoverboard/functions/node_modules/fsevents/build'
  SOLINK_MODULE(target) Release/obj.target/.node
  COPY Release/.node
make: Leaving directory '/home/xxx/dev/df_hu/git/hoverboard/functions/node_modules/fsevents/build'
added 352 packages in 2.239s

> hoverboard@3.0.0 install:emulator /home/xxx/dev/df_hu/git/hoverboard
> firebase setup:emulators:firestore

i  firestore: downloading cloud-firestore-emulator-v1.11.7.jar...
Progress: =========================================================================================================================================================================================> (100% of 64MB)
added 2843 packages in 26.089s

xxx@debian:~/dev/df_hu/git/hoverboard$ npx firebase firestore:delete --recursive --all-collections
? You are about to delete THE ENTIRE DATABASE for df-hu-dev. Are you sure? Yes
Deleting the following collections: 

xxx@debian:~/dev/df_hu/git/hoverboard$ npm run firestore:init

> hoverboard@3.0.0 firestore:init /home/xxx/dev/df_hu/git/hoverboard
> firebase functions:config:set schedule.enabled=true && firebase deploy --except hosting && ts-node-script ./internals/import-default-data

✔  Functions config updated.

Please deploy your functions for the change to take effect by running firebase deploy --only functions


=== Deploying to 'df-hu-dev'...

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

> hoverboard-functions@ prebuild /home/xxx/dev/df_hu/git/hoverboard/functions
> rimraf dist


> hoverboard-functions@ build /home/xxx/dev/df_hu/git/hoverboard/functions
> tsc


> hoverboard-functions@ postbuild /home/xxx/dev/df_hu/git/hoverboard/functions
> cpx ../dist/index.html dist/

✔  functions: Finished running predeploy script.
i  firebase.storage: checking storage.rules for compilation errors...
✔  firebase.storage: rules file storage.rules compiled successfully
i  firestore: reading indexes from firestore.indexes.json...
i  cloud.firestore: checking firestore.rules for compilation errors...
✔  cloud.firestore: rules file firestore.rules compiled successfully
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  storage: latest version of storage.rules already up to date, skipping upload...
✔  firestore: deployed indexes in firestore.indexes.json successfully
i  firestore: latest version of firestore.rules already up to date, skipping upload...
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (72.36 KB) for uploading
✔  functions: functions folder uploaded successfully
✔  storage: released rules storage.rules to firebase.storage
✔  firestore: released rules firestore.rules to cloud.firestore
i  functions: updating Node.js 12 function saveUserData(us-central1)...
i  functions: updating Node.js 12 function sendGeneralNotification(us-central1)...
i  functions: updating Node.js 12 function scheduleNotifications(us-central1)...
i  functions: updating Node.js 12 function optimizeImages(us-central1)...
i  functions: updating Node.js 12 function mailchimpSubscribe(us-central1)...
i  functions: updating Node.js 12 function prerender(us-central1)...
i  functions: updating Node.js 12 function scheduleWrite(us-central1)...
i  functions: updating Node.js 12 function sessionsWrite(us-central1)...
i  functions: updating Node.js 12 function speakersWrite(us-central1)...
i  scheduler: ensuring required API cloudscheduler.googleapis.com is enabled...
i  pubsub: ensuring required API pubsub.googleapis.com is enabled...
✔  scheduler: required API cloudscheduler.googleapis.com is enabled
✔  pubsub: required API pubsub.googleapis.com is enabled
i  functions: scheduler job firebase-schedule-scheduleNotifications-us-central1 is up to date, no changes required
✔  functions[sendGeneralNotification(us-central1)]: Successful update operation. 
✔  functions[mailchimpSubscribe(us-central1)]: Successful update operation. 
✔  functions[prerender(us-central1)]: Successful update operation. 
✔  functions[scheduleWrite(us-central1)]: Successful update operation. 
✔  functions[speakersWrite(us-central1)]: Successful update operation. 
✔  functions[scheduleNotifications(us-central1)]: Successful update operation. 
✔  functions[optimizeImages(us-central1)]: Successful update operation. 
✔  functions[sessionsWrite(us-central1)]: Successful update operation. 
✔  functions[saveUserData(us-central1)]: Successful update operation. 

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/df-hu-dev/overview
Importing blog...
Imported data for 5 blog posts
Importing gallery...
Imported data for 8 images
Migrating notifications config...
Imported data for notifications config
Importing partners...
Imported data for 14 documents
Importing 22 previous speakers...
Imported data for 22 previous speakers
Importing schedule...
Imported data for 2 days
Importing sessions...
Imported data for 40 sessions
Importing 27 speakers...
Imported data for 27 speakers
Importing 2 subteam...
Imported data for 12 documents
Importing tickets...
Imported data for 5 tickets
Importing videos...
Imported data for 22 videos
Finished

@abraham abraham closed this as completed Oct 2, 2020
@abraham
Copy link
Member

abraham commented Oct 2, 2020

Great!

@zptoth
Copy link
Author

zptoth commented Oct 2, 2020

An additional question. Might be off topic in this thread.

Just gave it a try to update the content (the name of a speaker for testing) and did an 'npm run deploy'
As far as I see the update I made won't appear, not even in Firestore.
However if I do an 'npx firebase firestore:delete --recursive --all-collections' first, the update is deployed.

What's the recommended way to update content? I assume there is more efficient way than deleting the entire database.

@abraham
Copy link
Member

abraham commented Oct 2, 2020

I use init once and then update content in the Firebase console. It would be nice to have a better admin interface (#698) eventually though.

@zptoth
Copy link
Author

zptoth commented Oct 2, 2020

Well OK, but in this case how do you handle differences in content at the development and production sites.
How do you sync content updates from dev to prod?

@cortinico
Copy link
Contributor

How do you sync content updates from dev to prod?

That's currently not supported by hoverboard AFAIK.
I used to use https://github.com/dalenguyen/firestore-backup-restore to backup/restore Firestore content and also sync dev => prod and vice versa.

@abraham
Copy link
Member

abraham commented Oct 3, 2020

There is the npm run firestore:copy source dest command. It's pretty easy to copy a collection around although it'll take some juggling of serviceAccount.json files. I would like to expand this to support copying an entire database in one go.

https://github.com/gdg-x/hoverboard/blob/main/docs/tutorials/firebase-utils.md

@abraham
Copy link
Member

abraham commented Oct 4, 2020

There is a node package that looks like it would make it fairly easy to export/import the entire DB. I started playing around with it a little in #1384 but haven't had time to get it working yet.

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

3 participants