boardgameio / boardgame.io

State Management and Multiplayer Networking for Turn-Based Games
https://boardgame.io
MIT License
9.99k stars 704 forks source link

Firebase version problem #573

Closed joepinion closed 4 years ago

joepinion commented 4 years ago

Was working on a feature this morning, and couldn't pass these tests: `Summary of all failing tests FAIL src/server/db/firebase.test.js ● construction

TypeError: instance.registerVersion is not a function

  38 |       this.client = require('firebase-admin');
  39 |     } else {
> 40 |       this.client = require('firebase');
     |                     ^
  41 |     }
  42 | 
  43 |     this.engine = engine === ENGINE_RTDB ? engine : ENGINE_FIRESTORE;

  at registerDatabase (node_modules/@firebase/database/index.node.ts:136:12)
  at Object.<anonymous> (node_modules/@firebase/database/index.node.ts:151:3)
  at Object.<anonymous> (node_modules/firebase/dist/index.node.cjs.js:7:1)
  at new Firebase (src/server/db/firebase.js:40:21)
  at Object.<anonymous> (src/server/db/firebase.test.js:43:14)

FAIL src/server/db/index.test.js ● FIREBASE_CONFIG

TypeError: instance.registerVersion is not a function

  38 |       this.client = require('firebase-admin');
  39 |     } else {
> 40 |       this.client = require('firebase');
     |                     ^
  41 |     }
  42 | 
  43 |     this.engine = engine === ENGINE_RTDB ? engine : ENGINE_FIRESTORE;

  at registerDatabase (node_modules/@firebase/database/index.node.ts:136:12)
  at Object.<anonymous> (node_modules/@firebase/database/index.node.ts:151:3)
  at Object.<anonymous> (node_modules/firebase/dist/index.node.cjs.js:7:1)
  at new Firebase (src/server/db/firebase.js:40:21)
  at DBFromEnv (src/server/db/index.js:24:12)
  at Object.<anonymous> (src/server/db/index.test.js:19:14)

` So I checked out master, built, tested, and got the same problem - and it's also happening on my commits.

In package.json, I removed the ^ from all the firebase dependencies - firebase/app, firebase, firebase-admin, firebase-mock - and the tests passed. So a new version of one of those packages is causing tests to fail (and is perhaps broken - I don't know because I don't use firebase).

I'm happy to roll them forward 1 at a time to see which is the actual problem later, but don't have time at the moment. Posting now in case someone knows off the top of their head based on the error what the problem is.

Or maybe I'm doing something wrong with my install command, but the tests even fail when I commit on my fork.

delucis commented 4 years ago

@joepinion The Firebase connector is going to move to a separate repo in the near-future, so this problem should go away then at the latest!

nicolodavis commented 4 years ago

That's right. I'm going to merge the changes to remove the connector sometime this week.

nicolodavis commented 4 years ago

I've merged the changes into the master branch.

@delucis Note that I added a createGame call to StorageAPI.

delucis commented 4 years ago

@delucis Note that I added a createGame call to StorageAPI.

Will you be able to expose db/base.ts (including its typings) in 0.39? That way I can depend on and extend that in my connector.

nicolodavis commented 4 years ago

@delucis Done.

The types are in boardgame.io/types. I'm not particularly satisfied with the directory layout, so this might change in the future.