Firebase Admin SDK in App Engine with Java 8

2019-08-23 12:36发布

Previously the Firebase Admin SDK would not run on App Engine with automatic scaling. Probably it will create some threads and the Thread class or something like that is not whitelisted.

Now that Google has given us support for Java 8 on App Engine (and removed the whitelist), would this problem be gone? Will the Firebase Admin SDK work on App Engine with automatic scaling?

1条回答
Juvenile、少年°
2楼-- · 2019-08-23 13:24

Firebase Admin SDK still won't work in the AppEngine Java 8 runtime without manual scaling, for several reasons:

  1. The threads support available in the Java 8 runtime comes with some limitations. For instance, any thread not created using the AppEngine's ThreadManager interface cannot call AppEngine APIs. This means these threads cannot make outgoing network calls.
  2. The database client code in the SDK spawns long-running threads. The only way to do that in the AppEngine environment is via background thread support. The SDK specifically looks for this feature when deployed in AppEngine. I've tried to run the SDK with this requirement relaxed, but it doesn't work. It seems request-scoped threads cannot outlive the request even in the new Java 8 runtime.

However, you should be able to use the FirebaseAuth interface (used for custom token minting, ID token verification and user management) in the AppEngine, without manual scaling. This part of the SDK supports running on request-scoped threads.

查看更多
登录 后发表回答