Is Java/JVM supported in the current firebase functions execution environment? - node.js

Currently, I have implemented Firebase Functions as Node.js.
I installed 'nodejs-java' module and deploy it to 'Firebase Functions', but it failed.
I think the reason for this problem is that Firebase Functions
I thought it was because it doesn't support Java.
The reason for my thinking is that I tried to print out the JAVA_HOME environment variable in the build environment to the console using a module called 'find-java-home', but nothing came out.
The point is, I wonder if Firebase Functions does not support Java language yet.
In addition, is gcc or python supported for firebase functions build environment?
I am not good in English. Thank you for reading it.
Please reply.

Related

Express JS in Altassian Forge causing "process.cwd is not a function" error

I am new to development on Jira Cloud and am currently exploring creating apps using the Atlassian Forge. I was trying to use Express JS in the code as a middleware. Turns out that during deployment, it keeps giving this error "process.cwd is not a function."
The error received while deploying the app.
I tried installing process module (via npm i process; which was successfully done) and updating the webpack version but none of it worked.
Can someone please tell what could be causing this error?
If possible please suggest the alternative for using Express JS in Altassian Forge?
Thanks in advance.
Apoorva
From the documentation:
When a Forge app is invoked, the JavaScript code is executed within the app sandbox. This environment differs from a traditional Node.js environment you might already be familiar with.
You'll need to write your functions in a subset of Node.js. Some globals are not exposed, for example:
process (except for process.env)
queueMicrotask
which means that some NPM packages that depend on these may not function correctly.
If Express JS depends on process.cwd(), that would explain the error. You may be able to work around this if it depends on it in theory but not in practice:
If process.cwd() is only used in test cases or example code, you can delete it or make sure it's not bundled.
If it is used, but using a dummy string like "/" would work, you could stub out the call using DefinePlugin or similar.

Why are Cloud Function Runtime Environment Variables being deleted on deploy?

I recently (2 days ago) upgraded the node runtime engine on our Cloud Functions instance from Node 10 to 12. (Not sure that is a factor, but it is a recent change.)
Since the upgrade I have been using the Cloud Functions project without trouble. Today is the first time I have done a deploy SINCE the deployment to change the node engine. After I did the deploy, ALL of the Runtime Environment Variables were deleted except one labeled FIREBASE_CONFIG.
As a test, I added another test environment variable via the Cloud Functions console UI. I refreshed the page to ensure the variable was there. Then, I ran another deploy, using this command:
firebase use {project_name} && firebase deploy --only functions:{function_name}
After the deploy completed, I refreshed the environment variables page and found that the test variable I had created was now missing.
I'm quite stumped. Any ideas? Thank you!
It is true that the Firebase CLI manages enviroment configuration and does not allow us to set the ENV variables of the runtime during deployment. This has been explained on other post as well, like this one.
I guess you are aware of the difference between the Cloud Functions Runtime Variables and the Firebase Environment configuration, so I will just leave it here as a friendly reminder.
Regarding the actual issue (New deployments erasing previously set "Cloud Functions Runtime Variables"), I believe this must have been something they fixed already, because I have tested with version 9.10.2 of the firebase CLI, and I could not replicate the issue on my end.
I recommend checking the CLI version that you have (firebase --version) and, if you still experience the same issue, provide us with the steps you took.

Azure Functions and Node.js

Let's say I have a Node.js app I want to build with a TimerTrigger on Azure Functions.
What would be the best way to develop it? I already tried setting the NODE_DEFAULT_VERSION to 8.7.0 but it's still giving me problems like incorrect syntax when I know the Node can handle it.
Does anyone have any experience building Node.js apps on Azure?
In the current version of the function runtime, you cannot choose the Node version. But in the next version, which is currently in Preview, you can and will be able to pick 8.7.0. See https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions for details.

AWS Lambda to Firestore error: cannot import name 'cygrpc'

On my AWS Lambda Python 3.6 function I'd like to use Google Firestore (Cloud Firestore BETA) for caching purposes, but as soon as I add
from google.cloud import firestore
to my Python script and upload ZIP to AWS Lambda function, Lambda test come back with error
Unable to import module 'MyLambdaFunction': cannot import name 'cygrpc'.
AWS CloudWatch log doesn't contain any details on the error, just that same error message.
Lambda function works great on my local dev machine (Windows 10), and I can write to Firestore fine. It also works on AWS if I comment out the import and all Firestore related lines.
Any tips how I could go about solving this?
The python client for Firestore relies on the C-based implementation of GRPC. This appears not to work by default in AWS Lambda.
Node.js users have reported similar problems and they've documented a workaround of building a docker image.
This should be similar to any getting any other python package that requires native code to work. Perhaps something like this method for getting scikit to work?
I hope this is enough to get you going in the right direction, but unfortunately I don't know anything about AWS Lambda :-(.
Ran into same issue, i solved it by using the plugin serverless-python-requirements for serverless framework and passing:
pythonRequirements:
dockerizePip: true
Essentially this installs your c-based packages (and all other packages) in a docker container where it would work and then symlinks them to your lambda fn.
A helpful guide can be found on: https://serverless.com/blog/serverless-python-packaging/
Plugin: https://github.com/UnitedIncome/serverless-python-requirements

Node.js-like firebase module for Parse cloud code

I'm trying to integrate Firebase with Parse to add real-time capabilities to my application. However, some API functions (like the ability to limit queries to Firebase with limit() or startAt()/endAt()) are not available with the firebase REST API.
They are available with the Node.js module, but even though Parse Cloud support CommonJS-like modules, I'm not sure it's possible to integrate the Firebase node module without some major tweaking.
Any idea how I could access these functions, other than running my own node.js server with the Firebase plugin and using it to redirect my calls to firebase?
It looks like it's possible. What you'll want to do is create a "Cloud Code Module" and wrap the Firebase tools you need. They have a tutorial here
It's pretty standard node.js structures. You put all your Firebase methods into exports, add an initialize method (this is where you'd probably do things like auth?), and you're off.
Wrapping Firebase isn't hard or lengthy. Here's a gist that wraps Firebase in a promise structure, for example. You could basically take the methods from that gist as a blueprint for wrapping them into Parse.
I find it not easy, firebase is dependent on faye-websocket and in its turn requires other libs. We can make it work using "Cloud Code Module" but I don't like adding libs this way.
This is a request for Parse to support node modules, unfortunately the answer is a flat NO from them for now https://parse.com/questions/using-npm-modules-in-cloud-code.
Would appreciate any update on this. Thanks!

Resources