Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup on Appengine Standard Environment #14

Open
matjazonline opened this issue Dec 4, 2017 · 0 comments
Open

setup on Appengine Standard Environment #14

matjazonline opened this issue Dec 4, 2017 · 0 comments

Comments

@matjazonline
Copy link

On GAE Standard Environment I encountered this error:

fatal error: all goroutines are asleep - deadlock!

Setup in init function:

`func init() {
bot := mbotapi.NewBotAPI(PAGE_ACCESS_TKN, "whk", "sekret")

callbacks, mux := bot.SetWebhook("/webhook")

var gaeCtx context.Context

var handlerFunc http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
	r = r.WithContext(appengine.NewContext(r))
	gaeCtx = r.Context()
	mux.ServeHTTP(w, r)
}

http.Handle("/webhook", handlerFunc)

for callback := range callbacks {
	log.Debugf(gaeCtx, "[%#v] %s", callback.Sender, callback.Message.Text)
	msg := mbotapi.NewMessage(callback.Message.Text)
	bot.Send(callback.Sender, msg, mbotapi.RegularNotif)
}

}`

I see that otherwise mbotapi would work by setting GAE's urlfetch.Client pointer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant