I have two projects on google cloud platform. The first, project A, in python 2, uses the standard google appengine runtime. The second, project B, in python 3, uses version 2 of google app engine. It is being developed specifically to address deprecation of the google app engine for python 2 coming up in january 2024. Project B uses the datastore and the file storage from the first project, using the Project A's IAM to grant Editor permissions to the second projets' service account.
Everything is tested on the production servers, us-central region both.
Everything seems to work exept one thing. Though uploading files using the blobstore API works,
deleting the stored files uploaded via Project B works (so the code must be ok), yet
deleting teh stored files uploaded via Project A fails. blobstore.BlogInfo.get for a valid (stored in the datastore model) blob key returns None.
I went crazy granting extravagant privelege storage and datastore roles to the service account of the Project B. Did not help.
Any suggestion is appreciated.
blob_key1_str = model.blob_key
if blob_key1_str:
blob_key = blobstore.BlobKey(blob_key1_str)
blob_info1 = blobstore.BlobInfo.get(blob_key)
if blob_info1:
logging.debug(f"success: [{blob_info1}]")
blob_info1.delete() # actual deletion of the storage
else:
logging.error(f"failed: blob info was not found")
The best solution, or rather workaround, that I see is to stop using a serpate GCP project. Instead taking the new python 3 code for the project B and use it in a version on the project A. That way (a hope, not tested yet) it will run under whatever permissions that set project A apart when dealing with the blobstore