APInf: Not able to add API using private IP address - fiware

I am not able to publish API on APInf(https://github.com/apinf/platform) with bare private IP address while the same API i am able to publish on API-Umbrella.
I have used latest version of APInf and API-Umbrella and followed the steps given at below URl for installation:
Installation Steps
I'd like to confirm that if we want to use APInf with our private certificates then what is the procedure to install?

there is an issue open about that (and it got promptly hijacked by other stuff):
https://github.com/apinf/platform/issues/3718
there is a workaround: ipv4 IPs you can do like this:
http://12.33.56.78
and should be fine. There is a regex protecting that field. We are going to do something about this when we have the time. Sorry for the inconvenience

Related

Public IP Address Works: Google Domain error "Took too long to respond"

I am using Google Compute Engine and have 3 clusters that are grouped that have given me a Public IP address that works.
I changed the name servers for my Google Domain to point to them as directions are listed here: https://cloud.google.com/dns/docs/quickstart
Problem: I am getting a "took too long to respond error".
Other Solutions I have tried:
Use A Record to forward to IP address
I can see that you are using Cloud DNS, I think you only need to complete your configuration.
If you want to continue using Cloud DNS you can follow the next steps:
Go to the DNS zone page in the Cloud Console.
Copy the server names and use it at your Google Domains
Or if you prefer you can work directly to with Google Domains, and you can follow this guide:
https://support.google.com/domains/answer/9211383?hl=en

Error on google function deploy, service account doesn't exist

Please can you help me, I'm receiving this error when I'm trying to deploy a google cloud function:
HTTP Error: 400, Default service account 'project-name#appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.
The command used to deploy is:
firebase deploy --only functions
A temporary solution is fine, but if you can help me to solve it permanently is better.
Thanks in advance.
In my case, the App Engine default service account was deleted. It looks like this: {project_id}#appspot.gserviceaccount.com
So I had to restore the service account like this:
You can now recover the deleted service accounts from https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/undelete
you have to get the UniqueID of the service account from https://console.cloud.google.com/home/activity
Source: https://stackoverflow.com/a/55277567/888881
The API explorer is an easy way to use the IAM API: https://developers.google.com/apis-explorer/#p/
I was struggling to resolve this issue, then I raised a case with Google.
here is a detailed article of my learnings :
https://medium.com/#ashirazee/http-error-400-default-service-account-appspot-gserviceaccount-com-accd178ea32a
Firstly navigate to Google Cloud Platform and view your service accounts.
try and find <project_id>#appspot.gserviceaccount.com' in your list of service accounts for the firebase project, it is linked to the App Engine.
if '#appspot.gserviceaccount.com' is missing you can not deploy anything(SEE EMAIL WITH GOOGLE BELOW), if it isn't, check and see if it's enabled, try disabling it and enabling it again.
#appspot.gserviceaccount.com is pre-installed by default, regardless of a paid account or not. try and recall if at any time you may have deleted it after or before deployment.
Now if you have for any reason deleted it over a period of more than 30 days than you can not retrieve it, and you must create a new firebase project. However, if it is within 30 days you can undelete it.
EMAIL FROM GOOGLE:
Email #1
"
Hello Ali
I am checking the logs of your project, unfortunately the service account was deleted on Ma, there is no chance to recover it nor recreate it
The only workaround available is to create a new project and deploy the service desired there. I know this could not be the best option for you nevertheless it is the way this works by design.
Do not hesitate to write back if you have more questions.
Cheers,"
Email #2,
"Hello Ali
I am glad to read that you have been able to deploy your functions successfully, unfortunately that service account cannot be recovered after 30 days of being deleted and that is the only solution. If you have other questions, please let us know by contacting us again through our support channel.
Cheers,"
lastly here is a helpful command line that will help you debug this, however, it won't help if there is no service account, it'll just highlight the obvious:
firebase deploy --only functions --debug
this was my error:
"HTTP Error: 400, Default service account '<project_id>#appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Clo
ud Functions API), or specify a different account."
Following the error message, you could enable the API by console accessing this url and enable the api.
Or by gcloud command:
gcloud services --project <project_id> enable cloudfunctions.googleapis.com
As the other stated, sadly, you need to use the default service account.
If within the 30 days period, you can use this tutorial to find and undelete the service acc: Read this guide to get https://cloud.google.com/iam/docs/creating-managing-service-accounts#undeleting_a_service_account
You have to enter the commands through the Google Cloud Console (one of the buttons will open a terminal on the right of the top blue app bar)
try to select Google Cloud Platform (GCP) resource location in Setting of Firebase. enter image description here

App Maker: Public facing IP for UrlFetch?

What are the public facing IP addresses, when app maker calls an external service with urlfetch?
My external service insists on white-listing these. Is there a public list available from google?
Within App Maker, I want to use the UrlFetch to call an external service, very much like the App maker sample.
I see there is a list of Apps Script's IP address ranges for the JDBC. Would this be the same ranges?
(https://developers.google.com/apps-script/guides/jdbc#accessing)
Thanks in advance,
John
Since App Maker uses Apps Script's URL Fetch service, you need to look at their doc to answer this question. From what I can tell from:
https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app
You need to go here:
https://cloud.google.com/appengine/kb/#static-ip
And then follow these instructions. Since Stack Overflow has an issue with simply posting links (although I really recommend you go to the link :), I'll summarize the instructions here:
nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8
And then nslookup each "include" in the response. This gives you all the IPs currently in use.
Edit: It looks like this might be the same IPs Google uses for it's general URL fetch service, which could mean that if you're whitelisting for these IPs you may also whitelist for all App Engine applications, and probably even more. Obviously you'd be whitelisting for all Apps Script and App Maker applications, so I assume this doesn't matter, but I just wanted to mention it. If your service is trying to rely on this for security reasons then, obviously, it's not adequate.
I had the same issue,
may be you can try the "useIntranet" option which may reduce the ipaddress range within your websites/webapps current network
https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app
eg:
var response = UrlFetchApp.fetch("https://Url.com",{
'method' : 'post',
'payload' :{
'useIntranet':true,
'key':"value"
}
}
);

ERROR 403 (FORBIDDEN) :Your client does not have permission to get URL

I want to get the web search results in XML or JSON format, so I'm trying Custom Search Engine to do this using REST API, but when put any URL with different parameters like cx, api key, query, scope. I get always the same error:
Your client does not have permission to get URL /search?q=socer&hl=en&start=10&num=10&output=xml&client=950599431012-4mdbg8eqvb30cf6hamamq8sfihn71qku.apps.googleusercontent.com&cx=006664130785464139277:u_p0bwcuncc from this server. (Client IP address: 105.190.4.82)
If there are other solution for my prob please show it to me.
Because 'Firebase' sanctioned some country like(Iran) this error responds to users.
Seems like your IP is blocked by Google.
Using vpn or a proxy should solve the problem.
I had this error when clicking on the Trigger URL of a Google Cloud Function, this answer on Server Fault solved the Error: Forbidden Your client does not have permission to get URL /MY_CLOUD_FUNCTION_NAME from this server cloud function.
It says that you need to
manually add the Cloud Functions Invoker permission to the allUsers
user in the Cloud Functions page in the Google Cloud Console.
Perhaps you also can change roles and permissions in your case to get it run?
In my case I had a vpn extension turned on by mistake in Google Chrome.
Well it's a hit-or-miss situation. Many users have faced this type of issue.
Please try a few solutions from below:
Clearing your browser history.
Try using a tool for cleaning up malwares.

Google Drive API oauth2 hangs on live server and returns no error when authenticating with auth_code

I have a huge problem where absolutely no error is returned from google nor php.
I've written a google client oauth2 connect model, which is perfectly working when I'm running it on my dev environment on my mac (I'm not using a simple localhost, it's actually vagrant what I'm using to mirror the production server as much as possible) but it doesn't work when I push it to production.
It's just simply not returning any error. The code reaches the part where I have the auth code from Google and it hangs at the part where I'm trying to exchange it for a token ( $client->authenticate($auth_code) ).
I really don't know what am I doing wrong, since everything is working perfect without errors on dev site (which has a public link by the way, and I tried accessing it from different public IP addresses).
The moment I push the code to a live server, it just stops authenticating. I have the correct oauth credentials set up for every production server, redirect uri is correct. I simply don't know what am I doing wrong...
Here's a part of code (I repeat, it perfectly works on dev server with publicly accessible url):
$this->client = new Google_Client();
$this->credentials_path . '/client_secret.json'
$this->client->setAuthConfigFile($this->credentials_path . '/client_secret.json');
$this->client->setAccessType('offline');
$this->client->setRedirectUri($this->redirect_uri);
$this->client->addScope(Google_Service_Drive::DRIVE_READONLY);
$this->client->authenticate($auth_code); //this is the part where the code hangs on a live server, but works perfectly on dev
$this->token = json_encode($this->client->getAccessToken());
$this->client->setAccessToken($this->token);
$this->writeTokenToFile($this->token);
if ($this->client->isAccessTokenExpired()) {
$this->client->refreshToken($this->token);
}
$google_drive_service = new Google_Service_Drive($this->client);
Any help would be very much appreciated!
AFAIK, you need to revoke the existing token before requesting another.
As mentioned in Offline access, when you set the API client's access type to offline, the client object will refresh the access token as needed.
With that, you need to revoke access given to an application. As mentioned,
part of the removal process can include an API request to ensure the permissions granted to the application are removed.
You may want to try revoking a token by calling revokeToken():
$client->revokeToken();
You may want to also check given solutions in the following SO posts:
Automatically refresh token using google drive api with php script.
Not receiving Google OAuth refresh token
Hope that helps!