Google App Engine batch error

I’m using Google App Engine for a golang api and I’ve been working without any issue in localhost, today I deployed to test it live and I got this error for 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?

Because outbound requests in google app engine are restricted somehow… 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)
1 Like

Hi @betocantu93,

Thanks for contacting Algolia and for the details in the error.

It seems like in the transition from local to production, your environment variables are not being read properly.

This post request does not know how to contact Algolia because it has no actual AppID or index name:

https://APPID.algolianet.com/1/indexes/INDEXNAME/batch

Can you troubleshoot setting your environment variables on Google App Engine?

Let us know how it goes!

Hi @ajay.david, sorry for not specifying, those are just placeholders for demostration purposes, my variables are correctly read, I just replaced them for this demo.