I followed the QUARKUS - GOOGLE CLOUD FUNCTIONS tutorial, but dependency injection doesn't seem to be working in that context as any #Inject'ed object is null at runtime:
both while testing locally,
and running on GCP too.
Downloading and running the tutorial solution gives the same result for me.
Am I missing something ?
This error is usually caused by using the wrong entry point inside the gcloud command.
You must use the Quarkus provided function and not your function as the entry point class from your gcloud command.
This is descibed in this part of the guide https://quarkus.io/guides/gcp-functions#build-and-deploy-to-google-cloud, maybe we need to make it clearer.
For a background function, use gcloud functions deploy my-function --entry-point --entry-point=io.quarkus.gcp.functions.QuarkusBackgroundFunction ...
For an HTTP function, use gcloud functions deploy my-function --entry-point --entry-point=io.quarkus.gcp.functions.QuarkusHttpFunction ...
The Quarkus function will bootstrap the framework (including CDI), search for your function and inject dependencies in it.
Related
Based on some quick searching, it doesn't look like this issue has been reported yet.
This occurs when locally testing in a firebase functions project with two or more http functions defined for different paths, when supplying the --inspect-functions flag in this command:
firebase emulators:start --only functions --inspect-functions
After a function is called for the first time, the mapping of http paths to functions is broken. Every subsequent call to any function path will be routed to the first function that was called, rather than the one that corresponds to that path.
Minimal code to reproduce: https://github.com/johnang3/functions-emulator-bug-demo
This occurs when using version 10.2.1 of the firebase CLI with firebase-functions versions 3.13.2 and 3.18.1. I have not tested any other versions.
It seems that you are using an outdated version of firebase-tools.
I've tried running the command below under the functions directory, then tried running the browsers found in your Github, and it works fine on my end.
npm install -g firebase-tools
today I had the following after running the command firebase functions deploy --only functions.
After much research, I found the command firebase functions:log
This showed me the "correct" error.
Provided module can't be loaded. Did you list all required modules in
the package.json dependencies?
The solution to my specific problems was:
remove node_modules folder
npm install in functions folder
In my case, After a long time of searching, I found the reason to be that I had disabled billing for the project for some time.
It now worked fine after I enabled it in the Google cloud console.
It would have been really helpful if firebase could show any useful error message to suggest the problem. I found this after many trials.
I'm currently developing Firebase functions using the Firebase emulators locally.
Every time I'm changing the logic in my functions, I want to simply run
firebase emulators:start
But it seems the latest changes are never included unless I first deploy the functions using
firebase deploy --only functions
This causes unnecessary deploys of unfinished code and adds a lot of time between testing each iteration.
Is there any way I can ensure the latest version of my functions are included when only running the emulators without running deploy? I've been scouring the documentation and couldn't find anything pointing me in the right direction.
So after snooping around a bit it seems that my functions written in Typescript are not compiled to javascript when only starting the emulators. The javascript in functions/lib/**.js is run, but since the Typescript is not compiled it will always run the previous version.
This seems like a bug on Firebase's side. The natural expectation when creating a firebase folder using Firebase-cli and running emulators from the root directory would be for the Typescript to be compiled.
I've sent a bug ticket to Google Firebase and will close this question. A work around is to create a script that runs tsc before firebase emulators:start.
I found in my package.json there's one of script named build, almost sure it's part of the firebase setup so everyone should have it too.
So just go to the functions folder and execute: "npm run build".
I'm trying to run the Web3j example available at https://github.com/web3j/sample-project-gradle
Unfortunately, there is hardly any information available on how to build and run the example, and newbies have to contend with learning Gradle in addition to the Web3j-Java interface.
I'm able to build the example (after creating a Wallet account with a JSON file, loading it with Rinkleby Ether and inserting my Infura API key into the Application file) as follows:
$ gradle build
which succeeds without errors. However, I am clueless on how to run the project...thanks in advance for any help.
s1b
Everything seems ok with the your project. Have you tried "Run as a Java application" option from the Eclipse IDE? I am running my Java smart contract functions in this way.
I'm following the google cloud functions tutorial here: https://cloud.google.com/functions/docs/quickstart
I install google-cloud-sdk and source both path.bash.inc and completion.bash.inc.
The gsutil command step works and creates the storage bucket.
When I run gcloud beta functions deploy helloWorld --stage-bucket [BUCKET_NAME] --trigger-topic hello_world replacing with my [BUCKET_NAME] I get usage help and the following error:
```
ERROR: (gcloud.beta) Invalid choice: 'functions'.
Valid choices are [app, auth, bigtable, compute, config, container, dataflow, dataproc, debug, deployment-manager, emulators, error-reporting, iam, init, logging, ml, organizations, projects, pubsub, service-management, source, sql, test].
```
I'm not sure how the gcloud command works, but I can see the functions directory in the lib/surface/ directory of the google-cloud-sdk.
Why does gcloud beta functions not work? How can I make it work?
Make sure you have the latest cloud SDK installed.
I got the same error and it seems I had version 137 while the latest is 152.
After running gcloud components update it was solved.
The functions are in subscription-only beta phase right now. From Quickstart:
Beta
This is a Beta release of Google Cloud Functions. This API might be
changed in backward-incompatible ways and is not subject to any SLA or
deprecation policy.
Want to get advance access to the latest and greatest? Click here to become a beta tester.
The gcloud cmd might be checking beta subscriptions. Did you subscribe?
Also make sure you have the most recent cloud SDK version.