API connection error from Google App Engine


#1

{“message”:“Error: Post https://api.omise.co/customers: dial tcp: lookup api.omise.co on [::1]:53: dial udp [::1]:53: socket: operation not permitted”}

We are trying to use the omise-golang library from the server we have on Google App Engine: which also is implemented with Go.

The problem that we are facing is the above error.
We are perfectly OK when accessing the API using the operations.CreateCustomer and operations.CreateCharge method from omise-go/operations library via the development server.

However once we deploy the code to the actual live GAE that then we get the error above.
We assume that it is the error related to the DNS and port configuration but we have no clue what so ever further than that.

What we have tried so far… are

  • opened the port to access from all IP adresses.
  • modified the namesever value in /etc/resolv.conf to 8.8.8.8
  • possible similar problem? Requests should have Google App Engine context?
    but this does not seem to be our case. since we are OK when we access from development server on our local machines.
  • we can get the IP address from the GAE console like below
> nslookup api.omise.co
  • however cannot send ping from GAE console
ping api.omise.co

no response

We are really happy if we get any clue on this. Having working around for several days…


#2

@tsukukobaan Google App Engine runs all applications in a very restricted sandbox. The sandbox normally disallows all regular HTTP calls. You are instead required to use AppEngine’s specific urlfetch package.

Unfortunately our library wraps the http client in its own way to try to provide maximum TLS security with minimal configuration for our merchants so it may not be possible to replace the internal HTTP calls used in the package yet.

However, it looks like it is not hard to provide a way to enable this (simple http.Roundtripper replacement). If our Go developers have spare cycles, they maybe able to take a stab. No promises, though.

In the meantime I suggest you fork our library and replace the http client configuration on line 47 to add a new http.Roundtripper from the GAE-provided urlfetch package. This should get you going, for now.


#3

Thank you so much for quick reply.
We were thinking of forking and modifying the line of you suggesting (though thought better of us asking before hand.

We’ll try as you suggest. Thanks a lot.