Anybody knows how to allow non-utf8 for appengine datastore keys?
I am using appengine for go.
Below is the error i get if i put non-utf8.
API error 1 (datastore_v3: BAD_REQUEST): key path element name is not valid UTF-8
project member said it is a design decision:
https://code.google.com/p/googleappengine/issues/detail?id=12896
Thanks.
Related
In Google App Engine (GAE), files that get stored to the local Cloud Storage show up in the admin console with a path. Example:
/gs/myapp.appspot.com.somefile.jpg
This one seems to get closer:
http://localhost:8080/_ah/img/encoded_gs_file:somefile.jpg
But that generates an error:
Error 404 ApplicationError: 6: Could not read blob.
This one works but it requires I know the key:
http://localhost:8080/_ah/img/encoded_gs_key:some_key
Is there a way to use the local url but use the filename instead of a key?
I think you should go through the details of this GitHub Code about how to read and write blobs. The code confirms that for image files, you always require the keys.
For Images, you require the Key http://localhost:8080/_ah/img/encoded_gs_file:[Keys]
While for other files: https://localhost:8080/_ah/gcs/default_bucket/file_name
I'm trying to delete a key from the memcache using the latest GAE console (https://console.developers.google.com/appengine/memcache). I used to be able to do this with the old console but I can't figure out the new one.
Sometimes I manually edit an entity with the GAE console and afterwards I need to delete the entity from the memcache so that my app uses the latest data. I know the entity is in the memcache since the old data is being served, but I can't find it with the memcache viewer.
Here is the new memcache console:
I leave Namespace blank because I don't use them.
I select Python String for the key type since I am using Python.
For the key, I've tried:
Key('Election', 6254893018906624)
aglzfm9wYXZvdGVyFQsSCEVsZWN0aW9uGICAgKSsmY4LDA
NDB9:aglzfm9wYXZvdGVyFQsSCEVsZWN0aW9uGICAgKSsmY4LDA
but none of them work.
Clicking the "Show all keys" link just produces a blank screen.
How do I get this to work?
Not sure for Python, but for Java, with Objectify, I have used this many times:
Namespace: ObjectifyCache
Key type: Java String
Key: aglzfm9wYXZvdGVyFQsSCEVsZWN0aW9uGICAgKSsmY4LDA (from your data)
I am getting the following error on the AppEngine DevServer in Go:
API error 1 (datastore_v3: BAD_REQUEST): ApplicationError: 1 app
"id1" cannot access app "id2"'s data
(where "id1" and "id2" are real identifiers used by two of my applications)
I have tried to empty the datastore using the --clear_datastore flag, and also specifying a new path to the datastore using --datastore_path. The latter did not seem to work, no data was stored at the new location. The former flag deleted the contents of the datastore, but whenever I try to upload a blob I get the error.
I am hoping there is something I can do to remedy this!
--EDIT: To clarify, I am not trying to move data across apps, I am merely trying to upload to the active app's blobstore. I am developing several apps at the same time (different companies), so the machine will have several datastores/blobstores. In Java this is not a problem, only in Go.
Also, this is only a problem on the DevServer, once I upload the app, everything works as it should.
Ex animo,
/Alexander.
GAE Apps cannot direcly access each other's data. This is a fundamental restriction. DevAppServer is merely preventing you from doing something during development that would be forbidden to a deployed app.
You can move data between apps via url fetching.
I just migrated to HRD and now its telling me i cant access my own blobs...
Uncaught exception from servlet
java.lang.SecurityException: This application does not have access to that blob.
at com.google.appengine.api.blobstore.BlobstoreServiceImpl.fetchData(BlobstoreServiceImpl.java:200)
at com.droidastic.telljokes.server.servlet.ServeBlobsServlet.checkBlobKeyExists(ServeBlobsServlet.java:100)
at com.droidastic.telljokes.server.servlet.ServeBlobsServlet.doGet(ServeBlobsServlet.java:64)
That happened to me before when I migrated to HRD. I had my keys stored as strings in the datastore, when I migrated, those stringed keys where not re-written. It was quite a nightmare.
Anyway, your blobstore keys were probably not re-written to point to the new keys in your new app in HRD. It could be because you stored them as a string or something other than the equivalent of BlobstoreKey in Java.
I am using the Python 2.7 runtime with NDB from the 1.6.2 SDK on Google App Engine.
I get the following error:
BadRequestError: app s~myapphr cannot access app dev~myapphr's data
Originating from this code:
device = model.Key(urlsafe=device_id).get()
I am accessing my app from dev.myapp.appspot.com that is aliased to myapphr. device_id was created on the same dev.myapphr version.
What is going on?
the dev server has a default default_partition of 'dev' and on production, HRD apps get a partition of 's'. If you create a urlsafe key on the dev server and store it as a string it will not work on a the production server with a different partition. the way to make keys portable is to save them in a ReferenceProperty with db or KeyProperty on ndb.
The prefix you see there ("s~" and "dev~") is called a partition. You can use the --default_partition flag for dev_appserver.py to change the prefix from "dev~" to "s~".