I’m using Google App Engine for a golang api with algolia and I’ve been working (indexing records) without any issue in localhost, today I deployed to test it live and I got this error for all my indexing operations
Cannot perform request [POST] /1/indexes/INDEXNAME/batch (APPID.algolianet.com): Post https://APPID.algolianet.com/1/indexes/INDEXNAME/batch: dial tcp: lookup APPID.algolianet.com on [::1]:53: dial udp [::1]:53: socket: operation not permitted
Any solution ideas?
I struggled with setting up algolia with app engine in production, you have to set up a different transport for the algolia client... here is it:
client := algoliasearch.NewClient(ALGOLIA_APP_ID, ALGOLIA_API_KEY)
transport := &http.Client{
Transport: &urlfetch.Transport{
AllowInvalidServerCertificate: true,
Context: appengine.NewContext(r), // r *http.Request
},
}
client.SetHTTPClient(transport)
client.initIndex(INDEX_NAME)
EDIT:
This is now fixed by golang 1.11 release, you can simply use algolia golang as is