Migrating from Go on GAE to Go on GAE using Google App Engine Go library...

58 views
Skip to first unread message

Adam Jack

unread,
Jun 27, 2020, 8:33:24 PM6/27/20
to google-a...@googlegroups.com
Hello,

I've been using GAE for a number of months running a go webapp (pretty vanilla HTTP with a Gorilla MUX.) It has been working well. I've recently started to want to access some of the GAE services and so am trying to start to use the GAE go library. I also want to be able to develop offline ('cos I often work where networks are poor.)

I cannot seem to get my head around reworking my environment to succeed. When I make GAE calls (e.g. to memcache) I get told "not an App Engine context".

I've tried reading documentation and Googling but I cannot seem to find the pattern of setup I am missing, if one exists. Maybe I've painted myself into a corner somehow.

I've tried wrapping/replacing my context.Context via appengine.WithContext, and my HTTP request. That said, I continue to get the same error message.

I tried calling appengine.Main (as some search results suggested) in my main but things just hung badly. I don't know how to refactor to support that entry point, but maybe I need to learn.

Hmmm, reading the code comment inside appengine.Main I see a new path to try, refactor so that when running on GAE the code sets up http handlers (somehow) and dives into appengine.Main, and when not in GAE it runs my own HTTP server. I think I can try that. Does anybody know of a code example I can see to emulate?

Further question ... once I am, in appengine.Main will all contexts I get (from the HTTP requests) be ok for me to with.Context wrapper, to store my own values? (I've read some older postings that this breaks the appengine context.)

Any pointers would be really helpful. I've googled and found "Getting Started" and such, and some migration docs, but I'm starting to feel I'm unintentionally following an uncommon path.

BTW: Separately, it seems that memcache works on standard but not flex (hopefully that is correct) which makes me think maybe memcache isn't a good solution for long term. Is it deprecated in favor of something else, or what?

Thanks in advance for any suggestions.

regards,

Adam
--
Responserack
- incidents happen, response is crafted...

Adam Jack

unread,
Jul 1, 2020, 11:52:02 AM7/1/20
to Google App Engine
For completeness, as I wandered in the wilderness confused I stumbled upon this:


... and I believe the answer to my question is *don't* do what I was attempting, instead skip the Google App Engine SDK (as a thing of the past) and go to Google Cloud APIs.

regards

Adam

Manpreet Sidhu (Google Cloud Support)

unread,
Jul 3, 2020, 7:36:27 PM7/3/20
to Google App Engine
Thanks for reaching out!

It seems as though you have resolved your question, and that’s great! The fact that you came back and posted your solution is great. This will allow others who face the same issue to be able to resolve their issue.

Regarding your query about Memcache, it is not deprecated, but simply just not available for the App Engine Flex environment. For a list of all deprecations, please consult this document.

This type of question is best suited for Stack Overflow as those channels specialize in answering Technical Questions. Google Groups are best suited for product discussions, release notes and service status updates. More details regarding our community support can be found here.

Reply all
Reply to author
Forward
0 new messages