How to use ujson with Google App Engine - google-app-engine

According to the official list of built-in libraries, ujson is available. However, the following app.yaml snippet:
libraries:
- name: ujson
version: '1.35'
...generates this error:
Usage: appcfg.py [options] update <directory> | [file, ...]
appcfg.py: error: Error parsing ./app.yaml: the library "ujson" is not supported
in "./app.yaml", line 89, column 1.
If I try to use other supported C libraries like numpy, it works fine. I am running SDK 159.0.0 (latest) and can even see a "ujson" entry in google-cloud-sdk/lib/googlecloudsdk/third_party/appengine/api/appinfo.py.
Any clue why ujson isn't usable?

ujson v1.35 was added to the app engine runtime in Python SDK version 1.9.55.
This sdk version wasn't included in the gcloud sdk until v161.0.0 (2017-06-28):
Updated App Engine components for Python to version 1.9.55. Please visit the release notes for details
Anecdote:
Some of us still prefer appcfg.py update . instead of gcloud app deploy app.yaml.(We are a rare and dying breed :D).
So in the past I noticed that the appcfg.py tool I was using was an older version from the older app engine tooling. Doesn't come with all the gcloud components update awesomeness. You had to download the binaries each time.
which appcfg.py should reveal the exact one being used which for me was:
$ ~/google_appengine/appcfg.py
I can't say I wasn't warned enough. Besides, I kept seeing this advice/warning each time I ran gcloud components update:
WARNING: There are older versions of Google Cloud Platform tools on your system PATH.
Please remove the following to avoid accidentally invoking these old tools:
/Users/jeff/google_appengine/endpointscfg.py
/usr/local/bin/endpointscfg.py
/Users/jeff/google_appengine/dev_appserver.py
So update to the latest version, update your paths to point to the right appcfg, and enjoy ujson or any of the goodies as and when they drop.
$ ~/google-cloud-sdk/platform/google_appengine/appcfg.py update .

Related

GAE: No longer able to update my Gaelyk project due to appcfg losing support

Recently tried to update my Gaelyk project (yes, it's old, but it works well and I still use it), but Google App Engine will no longer accept the update. The error message returned is "Deployments using appcfg are no longer supported. See https://cloud.google.com/appengine/docs/deprecations". The thing is, I never used appcfg to deploy my application; I used Gaelyk and Gradle. But obviously Gaelyk must have used appcfg under the covers.
I did download the replacement Google Cloud SDK, but this new tool is not similar at all to how Gaelyk and Gradle worked. Is there anything I can do to get Gaelyk to work anymore? Or is Gaelyk just dead and I need to rewrite my application (like in Node.js or something instead of Groovy).
This will be hard, however I will try to help you as possible. I think you may try to migrate it somehow to app.yaml configuration of GAE.
I am not sure what plugins are used in the project. From Gaelyk temple project I can see that it's using appengine-geb which, according to the documentation, behind the scenes, is using gradle-appengine-plugin (there is wrong link on this doc, but proper is bellow).
On the github of gradle-appengine-plugin I have found following.
There is a note:
NOTE: All App Engine users are encouraged to transition to the new
gradle plugin for their projects.
And in FAQ part there is following information:
How do I deploy with gcloud?
If you're using gcloud to deploy your application, the newest version of app deploy > doesn't support war
directories, you will need to provide it with an app.yaml OR you can
use the appengineStage task to create a directory that is deployable
in /build/staged-app
$ ./gradlew appengineStage
$ gcloud app deploy build/staged-app/app.yaml --project [app id]
--version [some version]
NOTES:
You must explicitly define all config files your want to upload
(cron.yaml, etc)
This does not work with EAR formatted projects.
I think the best option will be to migrate to new appenine plugin or if not possible try to implement is with gcloud app deploy command crating the config files manually (at least app.yaml). And for this migration I can provide you this document.
I hope you will manage somehow...
I can confirm that Serge's answer on the Gaelyk Groups site works; the same procedure that he figured out also worked for me. To summarize:
Run gradlew appengineRun as run previously with Gaelyk.
Copy all jar files inside the build\exploded-app\WEB-INF\lib folder into a \src\main\webapp\web-inf\lib folder (for me the new lib folder did not exist previously).
To deploy, use the new required gcloud tool, and instead of running gradlew appengineUpdate (which fails now), instead run
gcloud app deploy appengine-web.xml where that XML file can be found in your webapp/WEB-INF directory. I navigated to that directory to run the gcloud command, but you can use a relative path there if your working directory is elsewhere. (There are a number of optional flags associated with the gcloud app deploy command, but I didn't need any of them.)
Serge needed to use these instructions to convert datastore-indexes.xml to index.yaml and run gcloud app deploy index.yaml, however, I didn't need to do this because I had no datastores.

Using go delve with google app engine standard & dev_appserver.py

In the google release notes it says:
November 15, 2017
Go runtime notes
Updated Go SDK to 1.9.61
Add --go_debugging flag to dev_appserver.py to enable Delve debugging.
I'm using dev_appserver.py to fire up several services simultaneously, so that they all share the same datastore emulator, and it works great.
However, when I add that --go_debugging flag, I get lots of errors which I don't understand. If anyone has insight, I'd be grateful.
I get these kinds of errors for each service it tries to build:
can't load package: package -N: unknown import path "-N": cannot find module providing package -N
can't load package: package -l: unknown import path "-l": cannot find module providing package -l
Is there maybe a problem with launching several services at once?
Thanks!
Update Nov 2020:
With all the new changes to app engine being able to use standard go libraries at google APIs, now I can just run my go app locally without using dev_appserver, and let it attach to my local datastore emulator etc. Because of that, and thanks to vscode, delve debugging works great (with the go extension). So now I can step through my app engine standard go code.

AppEngine appcfg.py complains about wrong version

I have updated the AppEngine SDK for Python on my Mac to version 1.9.74.266.
I need to update a Python 2.7 Standard Environment App via appcfg.py (which is called from a complex build script updating multiple App Engine applications) but I get the following error:
Error 401
Your version of the AppEngine SDK is out-of-date. Please update your SDK ...
But this is what I just did.
What's wrong?

Total confusion about which path to use for GoLang AppEngine SDK

I'm having trouble referencing the AppEngine SDK.
After installing Google Cloud SDK, I'm using:
gcloud components install app-engine-go
to install the most recent version of the AppEngine SDK for Go, and afterwards I'm seeing 2 directories:
/usr/local/google-cloud-sdk
/Users/kieran/google-cloud-sdk
The first contains the AppEngine SDK files, the second does not.
In the PATH I'm seeing:
# The next line updates PATH for the Google Cloud SDK.
if [ -f ‘/Users/kieran/google-cloud-sdk/path.bash.inc' ]; then source '/Users/kieran/google-cloud-sdk/path.bash.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/kieran/google-cloud-sdk/completion.bash.inc' ]; then source '/Users/kieran/google-cloud-sdk/completion.bash.inc'; fi
Why is the gcloud installer adding a reference in the PATH to the google-cloud-sdk that does not contain the AppEngine SDK ?
I have read many different articles on here but they all mention a manually downloaded AppEngine SDK, and according to other articles even using "google.golang.org/appengine" is not good enough as it's not always the latest version.
How do I reference the AppEngine SDK that was downloaded by the glcoud installer? With 2 different SDK paths I'm totally confused about which one to use, and even how to reference it in code. I would assume that "appengine" would be sufficient, but that isn't working.

Upload Jruby on rails on Google App Engine - cannot find gem appengine-rack

Just trying to deploy a simple Jruby on rails app on Google App Engine but falling at first hurdle.
I've been following instructions on https://code.google.com/p/appengine-jruby/ and a few other websites. I've installed the gem 'google-appengine' as instructed and Command Prompt tells me that it's installed.
As I started typing require 'appengine-rack' in my config.ru, I can see that my IDE tells me it doesn't recognise this file. I fire up the local server anyway just as a test and it tells me that "LoadError: no such file to load -- appengine-rack".
I can clearly see in C:\jruby-1.7.3\lib\ruby\gems\shared\gems\appengine-rack-0.0.13\lib\ . So I'm a bit stumped. When I run >gem list, I can also see that this gem is there.
I'm doing this for the first time.
I'm using Windows 7. Jruby version 1.7.3. Rails 3.2.1.
Thanks in advance.
Looks like the project you are trying to use is rather old, (last commit date is Date: Mar 30, 2011). And it is written there that they are only planing to have a support of version 3.x.
Anyway here is the answer to your question(rather old too)
Unable to get google-appengine for Jruby to work
And this search could be helpful https://stackoverflow.com/questions/tagged/google-app-engine+ruby
From rational point of view it is not very good idea to use this gems for production. If you need cloud hosting for your ruby procejct heroku would be a solution.
If you require appengine - you better go Java, Python or Go which are officially supported.

Resources