Ajay Gautam
Ajay Gautam

Reputation: 1023

Unable to deploy java firebase function - what am I doing wrong?

Has anyone had any success with deploy a Firebase server function written in Java? I can't seem to find any documentation, and can't seem to get this going!

Project and config: https://github.com/ajaygautam/useradmin-firebase

When I run firebase deploy

It fails with No npm package found in functions source directory. Please run 'npm init' inside

Why do I need an npm setup in a java only project! How do I move forward?

Thanks in advance.

Ajay

askfirebase

Upvotes: 0

Views: 331

Answers (2)

Bakavani
Bakavani

Reputation: 131

Google now supports jvm runtime, you deploy using:

gcloud functions deploy kotlin-hello-pubsub --entry-point functions.KotlinHelloPubSub --runtime java11 --trigger-topic my-topic --allow-unauthenticated --memory 512MB

Refer: https://cloud.google.com/functions/docs/concepts/jvm-langs#kotlin_4

Upvotes: 2

Doug Stevenson
Doug Stevenson

Reputation: 317828

The Firebase CLI can only deploy functions written in JavaScript or TypeScript. In fact, there is no runtime for Java at all for Cloud Functions even outside of the Firebase ecosystem.

Upvotes: 4

Related Questions