Google Cloud Endpoints 2.0: Why is endpoints library not provided? - google-app-engine

With 1.0, we could just include 'endpoints' under 'libraries' in app.yaml.
libraries
- name: endpoints
- version: 1.0
However, for 2.0 we need to package it into vendored libraries.
"- version: 2.0" won't work throws an error, endpoints version "2.0" is not supported, use one of: "1.0"
Why was this seemingly regressive change made?

Related

Google App Engine providing .well-known Folder

I'm trying to provide a .well-known folder under my Google App Engine Application I'm using the standard environment and the python27 runtime.
with a web-app-origin-association.json file to try the Progressive Web Apps as URL Handlers
origin trial from chrome.
I've added the following code to my app.yaml file under handlers:
# .well-known Ordner
- url: /.well-known/(.*)
static_files: well-known/\1
upload: well-known/.*
The folder in my project is named well-known without a dot cause I've read that there are problems when using a folder Name with a dot at the start of the foldername.
But the url https://example.com/.well-known/web-app-origin-associate.json isn't available instead it works without the dot:
What do I have to change in order to make it work under https://example.com/.well-known/web-app-origin-association.json?
You can use the workaround documented at "Make skip_files rule explicit and tweak to allow .well-known/* to upload":
^(.*/)?\.(?!well-known(?:/|$)).*$
You many want to migrate to Python 3 as described in the guide:
Starting on January 1, 2020, the Python community will no longer
update, fix bugs, or patch security issues for Python 2.7. We
recommend that you update apps that are still running in the Python 2
runtime of the App Engine standard environment to the Python 3 runtime
as soon as possible.
The best way i found out about is to just do it like that:
- url: /\.well-known
static_dir: .well-known
secure: always
and use the python39 runtime.

Swagger UI configuration via Apache CXF's Swagger2Feature

I use the Swagger2Feature in Apache CXF to provide Swagger documentation for our API. Swagger UI is provided as a Maven dependency via WebJars.
I would like to configure some Swagger UI properties (as documented here), for example validatiorUrl. Is this possible to accomplish when using the combination of WebJars / CXF? I can't find a way to configure these settings "at runtime".
I'm using CXF 3.2.1 and Swagger UI 3.17.1.

How to stop mixed Content browser Error when calling App Engine Flexible Environment API?

I'm getting this error in browser:
Mixed Content: The page at 'https://{my-site}' was loaded over HTTPS, but
requested an insecure XMLHttpRequest endpoint 'http://{my-api}'. This request
has been blocked; the content must be served over HTTPS.
I know I need to allow https some how. The application uses Gunicorn to run the application on custom Google App Engine Flexible Environment. It also uses flask. Here is my app.yaml:
runtime: custom
env: flex
service: flex-module
entrypoint: gunicorn -b :$PORT main:app
Is it possible to change some setting in the Extensible Service Proxy to allow https in App Engine? Or do I need to get an ssl certificate and key and add the following to my app.yaml:
gunicorn -w3 --certfile=server.crt --keyfile=server.key test:app
Also i'm not sure if i need to add this to a gunicorn.conf.py as in this documentation:
forwarded_allow_ips = '*'
secure_scheme_headers = {'X-APPENGINE-HTTPS': 'on'}
Thanks
As stated in the documentation, Google does not issue SSL certificates for double-wildcard domains that are hosted at appspot.com:
Note: Google recommends using the HTTPS protocol to send requests to your app. Google does not issue SSL certificates for double-wildcard domains that are hosted at appspot.com. Therefore, HTTPS requests must use the string "-dot-" as the URL notation, instead of "." for separating subdomains. You can use the simple "." URL notation with your own custom domains and other HTTP addresses. For more information, see the HTTP and HTTPS examples in the following sections.
So to allow API requests over https and avoid the mixed content browser error, instead of http://version-one.my-app.appspot.com I needed to send request to: https://version-one-dot-my-app.appspot.com
To make HTTPS calls, enable the ssl library for your app by adding the following configuration to the app.yaml file:
libraries:
name: ssl
version: latest
https://google-auth.readthedocs.io/en/latest/user-guide.html

Jersey with Appengine Standard and CloudEndpoints

Our appengine application consists of several microservices deployed in a mix of standard and flex environments. Since we are using both flex and standard we chose jerse to implement our backend services as endpoint framework does not work with flex. We are not able to make this combination of Jersey + Appengine Standard + Endpoint work. When we deploy the swagger using gcloud cloud manager, it does not link with the backend services.
I could not find any documentation regarding how to integrate App engine standard and endpoint without using endpoint framework annotations.
Has anybody implemented the rest service backends using the combination
Jersey + App engine Standard + Cloud Endpoints. Is it possible to integrate Cloud endpoints and appengine standard without using endpoint framework annotations.
Pls note : We have tested Jersey + Flex + Endpoints and it works.
This is not tested or documented, so you are playing in a new area. It should work, and I'm happy to try and help you debug it. To use Endpoints on Standard with Flex, you have to do this:
Including this dependency:
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-management-control-appengine-all</artifactId>
<version>${endpoints.management.version}</version>
</dependency>
Add this configuration to your web.xml, then add a filter-mapping to go in front of jersey:
<filter>
<filter-name>endpoints-api-controller</filter-name>
<filter-class>com.google.api.control.extensions.appengine.GoogleAppEngineControlFilter</filter-class>
<init-param>
<param-name>endpoints.projectId</param-name>
<param-value>${endpoints.project.id}</param-value>
</init-param>
<init-param>
<param-name>endpoints.serviceName</param-name>
<param-value>echo-api.endpoints.${endpoints.project.id}.cloud.goog</param-value>
</init-param>
</filter>
Upload your OpenAPI specification using gcloud service-management deploy.
In appengine-web.xml, add an environment variable definition:
<env-variables>
<env-var name="ENDPOINTS_SERVICE_NAME" value="echo-api.endpoints.${endpoints.project.id}.cloud.goog" />
</env-variables>

App script appengine tutorial using Go

On the tutorial for Apps Script/Appengine:
https://developers.google.com/apps-script/articles/appengine
When trying to run google_appengine/dev_appserver.py google-apps-script/ the response is:
WARNING 2012-09-06 14:56:33,570 rdbms_mysqldb.py:74] The rdbms API is not available because the MySQLdb library could not be loaded.
INFO 2012-09-06 14:56:33,840 appengine_rpc.py:163] Server: appengine.google.com
CRITICAL 2012-09-06 14:56:33,842 appcfg.py:561] The api_version specified in app.yaml (1) is not supported by this release of the SDK. The supported api_versions are ['3', 'go1'].
I have tried the following app.yaml, but it doesn't work.
application: google-apps-script-tutorial
version: 1
runtime: go
api_version: go1
handlers:
- url: /*
script: _go_app
Also with - url: /rpc and it doesn't work. Since the code is Python is it possible to get App script and Go linked up in app engine?
The code for that tutorial is in Python and Javascript. If you want to use the go runtime, you will have to rewrite the Python portion in Go.
That example demonstrates the use of a Google Apps Script frontend with a Google App Engine (GAE) backend written in Python. GAE currently runs apps written in Java, Python, Go and PHP.
That particular Python backend accepts and produces messages in JSON format. Therefore, to link Apps Script and Go similarly, using GAE or not, you would need to replicate the functionality of the Python backend using, probably, the net/http library and the encoding/json library.
For examples of using these libraries together, have a look at this, this and this.
For examples on using Go with GAE, have a look at this and this.
Hope that helps.

Resources