How to call Oracle DB from Google Cloud Functions in Node.js - node.js

I'm trying to create a small Google Cloud Function (GCF) that will query Oracle DB and send email. I'm looking into using Node.js. I wasn't able to find anything useful, the only closes I found was a post regarding GCF to Oracle with Python. Please let me know if there is a way to call Oracle DB from GCF

In summary it's not possible because you need to install Instant Client and you can't on Cloud Function environment. Same issue with AppEngine Standard.
I'm writing an article on Medium on this. I'm waiting a bug fix on Cloud Run and the validation of Google (because some things can be confidential in it) before publishing it.
There is 2 workaround:
build a container (simply put an express server in front of your function, that's all!).
If you need to reach OnPrem Oracle DB you could deploy your container on AppEngine Flex (However don't scale to 0) and set up a serverless VPC Connector
If you don't need a serverless VPC connector, you will be able to deploy on Cloud Run in a couple of weeks, after the bug rollout
Use Java. You will have to download the Oracle Jar driver manually and to install it manually in Maven/Gradle, but then it work anywhere, even on AppEngine standard.
UPDATE
The bug with Cloud Run and GVisor has been solved. Here my article

Related

AWS Reverse Migration Set-Up localhost from AWS Console

I have been building a web application using python and AWS console on a borrowed computer for the past month.
I recently obtained a new computer and I am trying to change from developing my app online in AWS console to offline on my localhost.
Online, I have already an existing API, lambda Fucntions, Api Gateway, DynamoDb Tables.
Offline,I have the following tools installed: Linux, Pycharm, python 3.9 AWS CLI 2, AWS SAM CLI, Docker.
My misunderstanding lies in how to replicate the organization of the directories on my local computer.
And is there a simple command to import or clone or set-up my entire app/api locally
Any advice, direction, documentation or tutorials related to this reverse migration issue would be greatly appreciated.
Thank You

How to use GCP Runtime Configurator from Node.js?

I'm working on a Node.js application hosted on Google Cloud, using Google Application Engine. The app has a few settings like the following:
const TASK_BATCH_SIZE = 50;
Currently, every time we need to change some settings like that one to do some tests we need to re-deploy the app, and that happens very often. We are looking for some alternatives inside the Google Cloud ecosystem that allows us to configure our running services without needing to re-deploy.
One of the things we found in the docs was Runtime Configurator, which still seems to be a beta product. For Node.js specifically nodejs-rcloadenv is the only client library we found, but doesn't seem to support the Watcher / Waiter concepts described in the Runtime Configurator docs or any other way to subscribe to variable changes in a configuration resource.
Is Runtime Configurator the solution to our problem? Are there any other services inside the Google Cloud ecosystem, or any other library for Node.js that could help us with this?
If you want to update or to make some settings changes in the service, you need to re-delpoy the service.
You can't use Runtime Configurator as it's for Compute Engine and not for App Engine.
You can create a feature request on Google's Public Issue Tracker for your issue ( to update configurations without re-deploying the service).

confusions about firebase / cloud firestore

I been working on a React project using firebase auth and cloud firestore as the database and I been reading the official documents. But I am grappling with the idea of whether to use mobile/web SDKs and server client libraries and I am afraid I might have some misconceptions about Cloud Firestore Security Rules.
I read this page https://firebase.google.com/docs/firestore/client/libraries several times and it is about SDKs and client libraries for firestore. It seems to me that it suggests there are two ways of using firestore: one is through Mobile and web SDKs and one is through Server client libraries. And if I am using Mobile and web SDKs then my project would be classified as serverless since I am only building the front end and let Goole to handle the database and user authentication. The other way to use firestore, which is Server client libraries, it seems like it is meant to be used with your own server. It then refers to this as client libraries in the section, But the thing I don't quite understand is, what does client mean here? I'm sure it doesn't mean the same thing as in "the mobile and web SDKs support serverless app architectures where clients connect directly to your Cloud Firestore database.", where I assume a client is an end user who is browsing your website or web app. So what does this the client mean as in Server client libraries?
Since I am only able to build front end app or the client side app, I guess I should go with Mobile and web SDKs option to start using the firebase. Here comes the second question, when selecting a starting mode for my Cloud Firestore Security Rules, there are two modes: Test mode
and Locked mode. For Test mode, it says "Good for getting started with the mobile and web client libraries, but allows anyone to read and overwrite your data. After testing, make sure to review the Secure your data section.". My first confusion is, does client libraries refer to the Server client libraries previously I mentioned? If so, as a serverless project without a server I cannot technically I cannot choose this mode? Then for Locked mode it says, "Denies all reads and writes from mobile and web clients. Your authenticated application servers (C#, Go, Java, Node.js, PHP, Python, or Ruby) can still access your database." Again this option seems like it is not for me since it mentioned Your authenticated application servers, and for my project I don't have a server, or the server is on the google cloud platform. So can someone please correct me if I am understanding this wrong. Also, if I opt-in the Test mode, I suppose it allows anyone to read and overwrite my data. But I feel like there needs more explanation on the word anyone here. I think at least the person needs to have the exact firebase configuration as my project has. something like this
const config = {
apiKey: "myapikey",
authDomain: "my-auth-domain.firebaseapp.com",
databaseURL: "my-db-url.com",
projectId: "my-pid",
storageBucket: "my-storage-bucket",
messagingSenderId: "my-sender-id",
};
to access my database. I think by anyone, here it means anyone with this config file and doesn't need to log in to my project in order to mess with my database. This is my understanding, can someone please correct me? Finally, in my case, I just want that anyone who can log in to my project can have access to the database(both read and write). Which mode(test or locked) should I go with? Or I need more configuration for this?
Is it true that whether I choose web SDKs or Server client libraries to start my firestore project, I all need to use firebase-admin? But do I need to use Firebase CLI to init my project as a firebase project with the automatically generated firebase.json?
The official documents constantly use the word web and node.js, such as this image. . I actually don't know what they exactly mean. If I am writing React, should I go with web or node.js? If it belongs to web, I am importing stuff like import firebase from "firebase/app"; in my react project, these are also modules for Node.js. Again I am confused here.
I know this might be too long to read and the questions might be a bit trivial but I really appreciate if someone could clear up my confusion about firebase.
As far as I know, Here are the answers to your questions:
1) So what does this the client mean as in Server client libraries?
Server client libraries are used to access Firebase from servers which run on Java, Python, Go etc.
2) Which mode(test or locked) should I go with? Or I need more
configuration for this?
Test mode opens your database to the public which means any user can access your database without authenication.
Locked mode keeps your database locked down by default. You can then add rules to grant access to certain read or writes.
I would recommend to start out the project with this and later configure firestore security rules to open up access to your database according to your application's requirements. You can find references here : https://fireship.io/snippets/firestore-rules-recipes/
3) Is it true that whether I choose web SDKs or Server client libraries
to start my firestore project, I need to use firebase-admin? But do I
need to use Firebase CLI to init my project as a firebase project with
the automatically generated firebase.json?
firebase-admin available on npm is the Firebase Admin Node.js SDK to access your firebase database with admin privileges. This can be useful when you initialize/access the application specific configurations and parameters in your database.
You don't need Firebase command-line to initialize your firebase project and generate the firebase config file. You can access it through Firebase console of your project once you create your project in firebase. Reference : https://support.google.com/firebase/answer/7015592?hl=en
4) If I am writing React, should I go with web or node.js?
You should go with Web because node.js SDK is used for access to your Firebase services from privileged environments (such as servers or cloud) in Node.js.
Reference: https://www.npmjs.com/package/firebase
Additional Point: Found this for React in the Google's documentation for FIrebase SDKs. https://github.com/tylermcginnis/re-base
Hope its clearer now.

How to recover source code of Nodejs GAE project

I've an application which is deployed. I'd created simple get fetch services on cloud in a project and have deployed it. Unfortunately in confusion b/w the projects, I deleted the project. I can access the web service by fetching through urls but couldn't get the source code. Any help?
At the moment it's only possible to download Java, Python, PHP and Go application's source code.
What I can recommend you is to submit a Feature Request through this link asking for this feature also for Node.js. Also you may consider using Cloud Source Repositories, which is free and can help you mitigate this kind of issues in the future.

Firebase realtime database weird behavior

before this morning everything works perfectly with Firebase Realtime database. With my app, I retrieve nodes, update nodes through Firebase components. Since this moring, when I want to see Firebase realtime database on the console, it's blank, nothing to show like this. I already tried to refresh the page, to change for another brower, to log in/log out, it's always the same result :
The most weird is that for some users everything is fine but for others, they can't reach to authenticate on Firebase. They can't read new posts...
So, what's going on ?
There are no changes on the app code since 3 weeks and everyting was fine. The only thing is that a couple of days I received a message from Google Cloud Platform saying :
We’re contacting you because the Node.js project has informed Google that all current versions of v4.x to v8.x are vulnerable to an issue that can be used by an external attacker to cause a denial of service. This includes the current Google Cloud Functions (GCF) runtime Node.js 6.9.1. To mitigate this issue, Google will upgrade all functions to Node.js 6.11.1 on July 20th, 2017. We recommend you test your Cloud Functions with the new runtime version (Node.js 6.11.1) on July 17th.
Maybe that's the issue ? The update not finished well ? (Because I use Cloud functions for some data updates on the realtime database).

Resources