2

I'm trying to make my app engine server send APNS notifications, and for that I'm using template code I got from this project (which is said to work, so it's possible): https://github.com/GarettRogers/appengine-apns-gcm

For now, I want to make this work on my local development.

When getting to actually trying to open the socket, I get the error stack below.

My guess is that maybe app engine needs sudo permissions to do this (I'm using a mac). If so - does anyone know how I can make app engine run with sudo permissions?

If not - can anyone tell me what the problem is and how to fix it?

Thanks.

File "/Users/xxx/Downloads/XXX/ssl.py", line 392, in wrap_socket
ciphers=ciphers) 
File "/Users/xxx/Downloads/XXX/ssl.py", line 114, in __init__
if sock.getsockopt(SOL_SOCKET, SO_TYPE) != SOCK_STREAM:
File "/Users/xxx/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/dist27/socket.py", line 222, in meth
return getattr(self._sock,name)(*args)
INFO     2014-04-15 19:42:02,488 module.py:627] default: "POST /content/create_action HTTP/1.1" 500 228
File "/Users/xxx/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/remote_socket/_remote_socket.py", line 1112, in getsockopt
raise _SystemExceptionFromAppError(e)
error: [Errno 13] Permission denied
Lior Z
  • 668
  • 1
  • 9
  • 21
  • Have you enabled billing ? – Tim Hoffman Apr 15 '14 at 22:43
  • Yes. But again, I need this to run on my dev instance, since I don't want to debug on my prod. As written in the Google AppEngine docs, this should be possible… – Lior Z Apr 16 '14 at 09:55
  • I missed that, your trying on dev. So just run the dev server from the command line with sudo. – Tim Hoffman Apr 16 '14 at 10:53
  • Did that - didn't work. Maybe it's something with the connection itself or a flag I need to set? – Lior Z Apr 16 '14 at 11:09
  • Same problem happening to me with the sample program using flask... Tried to run with admin permissions on windows but got the exact same error when trying to bind the server socket... – El Ninja Trepador Apr 24 '14 at 09:33
  • Also having trouble with things like these: https://stackoverflow.com/questions/49409783/google-app-engine-permission-denied-proxy-tunneling-on-development-server ? – Cosmin Poieana Mar 21 '18 at 17:35

2 Answers2

1

Apply this: "ImportError: No module named _ssl" with dev_appserver.py from Google App Engine

The question/answer explains it all, I won't go into detail, It's a long standing SDK deficiency, this manual method patches it, you need to apply it each time you update the SDK

Community
  • 1
  • 1
Kaan Soral
  • 1,589
  • 1
  • 15
  • 31
1

I solved this via

pip install requests-toolbelt -t lib

then add

from requests_toolbelt.adapters import appengine
appengine.monkeypatch()

source: Can Python Requests library be used on Google App Engine?

Saim Abdullah
  • 174
  • 14