Yesterday this code was working fine both in local and production servers:
import cloudstorage
def filelist(Handler):
gs_bucket_name="/bucketname"
list=cloudstorage.listbucket(gs_bucket_name)
logging.warning(list)
self.write(list)
for e in list:
self.write(e)
self.write("<br>")
From yesterday to today I've upgraded GAE Launcher and changed the billing options (I was using a free trial and now a paid account) (not sure if it has anything to do, but just to give extra information)
But today the code stopped working in local (works fine in production)
This is the beginning of the error log
WARNING 2015-02-20 09:50:21,721 admin.py:106] <cloudstorage.cloudstorage_api._Bucket object at 0x10ac31e90>
ERROR 2015-02-20 09:50:21,729 api_server.py:221] Exception while handling service_name: "app_identity_service"
method: "GetAccessToken"
request: "\n7https://www.googleapis.com/auth/devstorage.full_control"
request_id: "WoMrXkOyfe"
The warning shows a bucket object, but as soon as I try to iterate in the list I get the exception on the identity service.
What is hapening? Seems that I need to authorize local devserver gcs mockup, but I'm not sure how.
Remember this is only happening in devserver, not in production.
Thanks for your help
This is a problem with the latest release (1.9.18). For now, until it gets fixed, you can downgrade to 1.9.17 by downloading the installer from here and just running it: https://storage.googleapis.com/appengine-sdks/featured/GoogleAppEngineLauncher-1.9.17.dmg
As per the answer below, the 1.9.18 has been patched with a fix for this. If you still want to install the 1.9.17 version, please follow this link: https://storage.googleapis.com/appengine-sdks/deprecated/1917/GoogleAppEngineLauncher-1.9.17.dmg
It's a known bug in the dev_appserver, where the SDK does not cope with the credentials already persisted in earlier versions. For me (on Ubuntu 15.10 with SDK 1.9.33) it helped to simply remove a file:
rm ~/.config/gcloud/application_default_credentials.json
as suggested in the bug issue filed by Jari Wiklund.
Update: As of March 5th, 2105 this was fixed in the public release of 1.9.18, which may be a simpler way to get the fix.
Note: while the fix was in Python, issue can surface in Java, PHP and Go also because they use the Python local dev server code.
I do believe that the cause of the problem is a bug in the local dev server (GoogleAppEngineLauncher), recently released.
I'm experiencing something similar in the PHP runtime: GloudStorage fails locally
Related
I'm having the exact same issue as another unanswered post, but I'm willing to give whatever code/setup needed to get the question answered properly.
Like in the post I mentioned above, I am also trying to deploy files to S3 with the AWS CLI and I receive the same error:
upload failed: ... An HTTP Client raised and unhandled exception: unknown encoding: idna
I have the newest version of Python and the AWS CLI. I can get the Python shell to import encodings.idna, but the AWS CLI process boots its own shell to run the commands I assume. Which may mean that I need to somehow inject the import statement into the AWS CLI process. I've tried to edit the aws.cmd programs (one in /bin and one in /scripts), but nearly every change stopped the program from working properly.
I'm not sure what to post that can help determine what my issue is, so please let me know.
I just saw that I left this question unanswered. So, here's what I did to fix the issue.
Shortly after posting this question, I tried the AWS CLI Windows Installer once more and it worked. I still don't know why the initial installation didn't work, but I am able to upload to S3 via CLI without Python encoding errors.
I've been successfully running the local development server daily and have made no changes except that I called "gcloud components update" just before it stopped working. Now I get:
..snip... <<PATH TO MY SDK>>/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 518, in _parse_configuration
with open(configuration_path) as f:
IOError: [Errno 2] No such file or directory: 'app.yaml'
Of course app.yaml hasn't moved.
Any thoughts?
It looks like there's an active issue on Google's issue tracker (opened on Oct 2, 2018) pertaining to this:
After updating to the Python (2.7) extensions for GAE to version
1.9.76, I am no longer able to run my code with dev_appserver.py
As of Oct 3, a fix appears to be in the works, but for now they suggest downgrading Google Cloud SDK to version 218.0.0:
It seems like you are affected by a known issue regarding ‘dev_appserver.py’ breaks in Google Cloud SDK version [219.0.1]. App Engine specialists are currently working to resolve it. However
there is no ETA at this moment. As a workaround you can downgrade the
Google Cloud SDK version using this command:
gcloud components update --version 218.0.0
The assignee of the issue will post an update on that issue when it has been resolved.
UPDATE (OCT 9, 2018): Cloud SDK version 220.0.0, which fixes the dev_appserver.py issue, is now available. I updated (via gcloud components update) and verified that it works. (Note: there are already a couple of complaints on the Issue Tracker that dev_appserver.py takes too long to load now. I didn't notice a significant difference from version 218, but I didn't compare timings.)
You may create make file and have something like this:
export SDK=dev_appserver.py
export APP_PATH=${CURDIR}
run:
$(SDK) $(APP_PATH)/path-to/app.yaml
And just use it with: make run so you don't have to worry about paths.
cd to the directory with app.yaml in it and try again
On Windows, dev_appserver.py %CD% is enough if your .yaml file has the default app.yaml name. Otherwise dev_appserver.py %CD%/your-file-name.yaml
This worked for me: in app.yaml, change
runtime: go
to
runtime: go111
I'm trying to create a webservice using webapp2 and datastore in python. But whenever i try to run "dev_appserver.py app.yaml" it throws me the following error
ERROR 2017-10-11 05:44:16,207 instance.py:280] Cannot connect to the instance on localhost:17514
But when i ran the same program using mac it working perfectly fine. Is I'm missing something here, Please find the screeenshot of components i have installed in gcloud.
Could somebody tell what i'm doing wrong here? I'm newbie to google cloud platform, if i am doing something wrong kindly point me to right direction. Any help would be appreciated. Thank you.
I see the same errors when trying to execute the dev_appserver.py from the Cloud SDK version 174.0.0.
However the dev_appserver.py from the standalone GAE SDK version 1.9.61 (theoretically the same being packed into the gcloud SDK 174.0.0) is running fine.
So one possible workaround to try would be to also install the standalone GAE SDK and run that dev_appserver.py instead.
Note: this is on linux, though, YMMV.
Related: What is the relationship between Google's App Engine SDK and Cloud SDK?
The problem is fixed. Like #DanCornilescu said it's an environment issue. I deactivated the virtual environment. And It works fine with no issue.
Solution for macOS. Maybe it works on Linux and Windows:
Find and remove folder:
appengine.None.<USER_NAME>
from the:
/var/folders
In may case:
/var/folders/6w/v0865mm96rj85dlwnr311bt00000gn/T/appengine.None.<USER_NAME>
I'm refactoring some of my old golang applications and I ran into this problem. I'd oversimplified the spin-up of my web server not realizing this is a critical block of code:
// Critical to work on AppEngine
port := os.Getenv("PORT")
if port == "" {
port = "8080"
log.Printf("Defaulting to port %s", port)
}
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), r))
Hope this helps.
I'm dealing with legacy code on Ubuntu server. I've encountered something weird: after Apache restarts (a full server restart), the site is still using old code, even if views.py was deleted.
Please, provide me some suggestions/tips - what might cause this server behavior?
I had this problem. In my case, running the following command solved it :
touch myproject/wsgi.py
No need to restart server or delete .pyc files. It's all explained in mod_wsgi docs.
I'm having this weird problem where when I run an app on GAE locally on Windows 7. Everything works fine except when I update the code; It works well the first 10 minutes and then it doesn't update when I edit the code. I have to close the server and open it again.
It's not a cache problem, because even if I try it in a different browser the content still doesn't change.
I tried reinstalling python and appengine and it worked fine for 2 days, but then problem came back again. I would appreciate any help.
Thanks!
Since your issue is limited to Python files, it sounds like a bug that was brought up in the discussion forum and issue tracker.
The suggested workaround in the forum is to remove the .pyc files corresponding the .py file you are editing, restart the local server, and continue. Obviously this is sub-optimal, so I would suggest 'starring' the bug in the issue tracker to keep track of updates.