google-app-engine


How do we parse and generate App Engine URL-Safe Datastore Keys in the Google Cloud API?


We have some URL-safe Datastore Keys that were created using in the AppEngine API, for example agx0cmFkZW9zLXRlc3RyHQsSEHVzZXIvTGVnYWxFbnRpdHkYgICAgIDu1AkM
These are parsed correctly in the AppEngine API, using com.google.appengine.api.datastore.KeyFactory.stringToKey(key)
However, in the Google Cloud API, com.google.cloud.datastore.Key.fromUrlSafe(key) always generates a parsing error as below.
Perhaps the URL-Safe string formats of the Google Cloud API was changed incompatibly, but we do need to be able to parse and also to generate the old format.
The code for this is available in the App Engine API distribution. It de/serializes a ProtoBuf Reference object.
Ultimately this is a string-parsing task with no deep dependency on the libraries, so it should be possible to do with a simple code snippet and without any code specific to the App Engine API.
How can we parse and generate such key strings using the Google Cloud API?
java.lang.IllegalArgumentException: Could not parse key
at com.google.cloud.datastore.Key.fromUrlSafe(Key.java:205)
...
Caused by: com.google.protobuf.TextFormat$ParseException: 1:61: Expected "{".
at com.google.protobuf.TextFormat$Tokenizer.parseException(TextFormat.java:1064)
at com.google.protobuf.TextFormat$Tokenizer.consume(TextFormat.java:750)
at com.google.protobuf.TextFormat$Parser.skipFieldMessage(TextFormat.java:1770)
at com.google.protobuf.TextFormat$Parser.mergeField(TextFormat.java:1528)
at com.google.protobuf.TextFormat$Parser.mergeField(TextFormat.java:1439)
at com.google.protobuf.TextFormat$Parser.merge(TextFormat.java:1423)
at com.google.protobuf.TextFormat$Parser.merge(TextFormat.java:1342)
at com.google.protobuf.TextFormat.merge(TextFormat.java:1221)
at com.google.cloud.datastore.Key.fromUrlSafe(Key.java:200)
... 1 more
in the absence of a fix to the bug report that #snakecharmerb found, could you not base64 decode the string and tease out the pieces that you need to construct a Key via the Key.newBuilder method?
Certainly not ideal, but would get you around the issue.

Related Links

Why does my Google App Engine Mail API calls still result in a DeadlineExceededError despite putting them in a task queue?
Size limit in Google Big Table
How can I verify if record with particular key_name already exists in the datastore?
Prevent Google App Engine from remembering session of non-admin user when using security-constraint
Master pages for GAE project (python)
is entry.key.id unique across all entries of a model?
How to handle counter updates in the GAE datastore properly?
Can Google App Engine's ImagesServiceFactory.getImagesService() be used in unit tests?
Http-TCP/IP proxy programming
domain aliases and Google App Engine
How do you treat a ReferenceProperty like a boolean in AppEngine Datastore?
Channel API: will presence get a disconnected notification when token expires?
Parse Error: Expected no additional symbols at symbol
I have installed the grails appengine plugin, I use intellij, how can I get intellj to quit yelling at me for jdo errors?
How to go about updating the GAE SDK?
How to change keys in Objectify

Categories

HOME
android
shell
url-redirection
nvd3.js
case
yahoo-finance
battery
pclxl
replace
rds
emscripten
babeljs
maxscript
tvos
pkcs#11
syntaxnet
php-5.6
spring-social
openbugs
gruntfile
linear-algebra
dynamic-sql
fileserver
android-7.0-nougat
vuejs
symfony-console
bourbon
libigl
named-entity-recognition
r-mice
qliksense
android-sharedpreferences
motion-detection
angularjs-components
jasmine-node
progress-bar
intersystems-cache
bringtofront
tizen-tv
carrierwave
biztalk-rule-engine
reactjs.net
fossil
sql-delete
apic
typesafe-config
c9.io
android-softkeyboard
escpos
parser-generator
microsoft-metro
logback-groovy
ssrs-2014
oracle-service-bus
signal-strength
stylecop
uiimage
phpdbg
plan-9
httrack
chai-as-promised
hammer.js
mongotemplate
google-cse
cpu-cache
py2neo
javafx-css
cvxpy
rocks
meteor-packages
omxplayer
seek
preprocessor
jclouds
riot
angular-ui-typeahead
exim4
custom-errors
qt5.2
rewrite
google-books
text-search
batik
dulwich
vacuum
haskell-warp
baasbox
beatsmusic
primitive-types
structuremap3
paw
universal-image-loader
template-deduction
kissfft
jjaql
alternate
cfcache
oocss
inappsettingskit
cnf
web-notifications
adobe-media-server
floating-point-exceptions
cgimage
google-maps-mobile
node-redis
entity-attribute-value
cac
metaweblog
aspmenu
visualj#
google-wave
httpcookie
lemmatization

Resources

Encrypt Message