I'm developing a Cloud Endpoint in Google App Engine Standard (Google Cloud), and API calls are woeking both locally and in deployed Google App Engine.
I'm trying to Restricting API Access with API Keys as specified here, following step by step:
https://cloud.google.com/endpoints/docs/frameworks/java/restricting-api-access-with-api-keys-frameworks
I have also configured my openapi.json file:
"securityDefinitions":{
"api_key": {
"type" : "apiKey",
"name": "key",
"in": "query"
}
}
"security": [
{
"api_key": [ ]
},
but i can still access my methods without adding any ?key= to the url.
I've also notice that in Google Cloud Console, in Endpoint section, i can see my deployed APIs, but I don't see any activity from my API, when I'm making calls, ans these appear in Google App Engine Log.
What is missed in the configuration?
Thanks.
Related
I created a Google Pub/Sub push subscription which points to a Google App Engine endpoint, but GAE is not receiving anything.
The messages are being published (I can see it on the Pub/Sub console), but never acknowledged.
The endpoint URL should be correct since I made my GAE endpoint public and tested using Postman.
Does Google Pub/Sub not support calling Google App Engine endpoints?
Or I'm I missing something here?
Appreciate it someone could help with this.
For a message to be acknowledged, it means it has to be received by the subscriber. How are you trying to do this? I ask because GAE (at least GAE standard) doesn't support streaming which means you can't have an indefinitely open connection listening for messages from pubsub.
Yes Google Pub/Sub supports calling to Google App Engine endpoints. I referred to this documentation.
As per the document, I used App Engine Flex Environment with Pub/Sub push subscription and I am able to fetch the messages that were published from Pub/Sub to the endpoint.
You can refer to the below mentioned steps :
Create one application using App Engine Flex Environment by referring to this document.
Deploy the application to GCP .
The files needed for application deployment are app.yaml, requirements.txt, main.py and index.html file inside a template folder.
Folder structure:
Demo→
app.yaml
requirements.txt
main.py
templates→
index.html
Provide the Pub/Sub topic name and token id ( should be the same as Pub/Sub push endpoint token id ) in the app.yaml file.
env_variables:
PUBSUB_TOPIC: your-topic
PUBSUB_VERIFICATION_TOKEN: 1234abcd
Run gcloud app deploy on the demo directory.
After the application is deployed, you will get an endpoint URL with the format : https://PROJECT_ID.REGION_ID.r.appspot.com
Example: https://mydemoproject.uc.r.appspot.com
Create a Pub/Sub topic and subscription and make the delivery type as push.
We need to provide a push endpoint with the format : https://mydemoproject.uc.r.appspot.com/pubsub/push?token=1234abcd
When an application is deployed in App Engine we can access that application at - https://PROJECT_ID.REGION_ID.r.appspot.com
The messages will be received by any of the instances of your application deployed in App Engine.
SSH into your instances and use the App Engine endpoint URL in the VM.
Output of instance 1:
Output of instance 2:
I have a couple of running Cloud functions that fetch data from an external API and then post the received data into an internal API which is running on Google App Engine. I've come up with this approach because the external API has a rate limit that I sometimes need to bypass.
In order to calculate the monthly cost of this setup I was looking at the Google Docs and saw this:
Outbound data to other Google APIs in the same region is free, as is inbound data. Where the Google API you are using is global (i.e. not region-specific), it is considered to be the same region.
My question: What does Google mean with "Google APIs"? Is an App Engine endpoint (e.g. xxx.appspot.com) a Google API?
Google APIs generally refer to the APIs and services provided as part of Google Cloud, as well as other Google services such as SMTP provided by Gmail and recaptcha.
Trying to publish a .NET Core app to Google Cloud following this guide;
https://cloud.google.com/dotnet/
I get to this screen;
Clicking on "Enable the services" and it does nothing. I have gone into the Google Console and enabled Google App Engine Flexible Environment. What else needs to up enabled?
You need to enable these services:
App Engine Admin API
Google App Engine Flexible Environment
for you project.
You may use Google Cloud Console: API & Services
I'm trying to connect and get data from Google Cloud Datastore API.
After disabling my App Engine Application (which have no use for me at the moment), I cannot access any GC Datastore API methods.
When I send my request, I always get the following response:
{ [Error: The project [my-project] does not exist.] code: 404, metadata: Metadata { _internal_repr: {} } }
I've already double-checked this and my project name is correct.
Accessing the google cloud console, I noticed that the datastore dashboard also show the same message:
Then, after enabling the app engine application again, everything works.
I know that GC Datastore was initially created to work with App Engine, but since last year it was supposed to be available everywhere (according to this).
Someone have a tip about this issue? Any help would be appreciated.
Thanks.
The Google Cloud Datastore API currently requires that the associated App Engine application not be disabled.
I've filed https://github.com/GoogleCloudPlatform/google-cloud-datastore/issues/107 to track this. It's something we may be able to fix in the future.
I wanted to ask what the difference between Google App Engine, Google APIs Console and Google Cloud Console is?
I will deploy a Project which will fetch some Websites and provide the data to my Android Application.
What is the best to use? I do not know what is for what.
Google App Engine lets you run web applications on Google's infrastructure : https://developers.google.com/appengine/docs/whatisgoogleappengine
Google APIs Console is Console to administrate Google API (deprecated)
Google Cloud Console is new version of Google APIs Console.
So for your Project use Google App Engine.
And for example use URL Fetch https://developers.google.com/appengine/docs/python/urlfetch/
A bit of background: At one point in time, Google APIs had its own console and Google App Engine had its own console. Eventually, it was decided that we should merge these two consoles into one console. We've already turned down the APIs console, and we're working on turning down the App Engine admin console.
So to answer your question: you should use the Cloud console unless you need to use the App Engine admin console for some obscure reason.