-
Notifications
You must be signed in to change notification settings - Fork 1k
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
When using gcloud preview app run
appengineTokenFunc is nil, causing a panic
#142
Comments
cc/ @okdave |
Also, I forgot to mention that I verified that |
We are having the same issue here. @m4tty did you find a workaround for this? |
@broady you were looking at something similar about build tags in the oauth2 packages |
Probably something to do with commit ad01282 |
Yes, ad01282 is related, but not the cause of this particular bug. @m4tty - can you explain why you're using If you really need control over the token source, then you should likely be using |
In order to leverage appengine storage api, we do the following:
Similar to this example: In any case, the appenginevm/appengine build flag isn't passed in when using @cnbuff410 I'm getting around the problem right now by using my own fork of oauth2 that has removed the build flag in appengine_hook.go. This allows things to work fine in my environment (which is appengine for the most part so the dependency doesn't hurt me any). i.e. i'm not leveraging oauth2 in any other contexts. |
@broady I'll try using DefaultTokenSource, but a quick glance looks like I might hit a similar issue as it passes by the appEngineTokenFunc check - https://github.com/golang/oauth2/blob/master/google/default.go#L87 and returns an error. |
yes, using Also, is there a reason you are using |
DefaultTokenSource worked great. And thanks for reminding me to We are using Anyway, thanks @broady I really appreciate the help. This is a solid work around to the issue. |
Was the original bug related to AppEngineTokenSource? DefaultTokenSource is handy, but we must still support AppEngineTokenSource both on dev and prod on AppEngine and AppEngine managed VMs. |
Original bug is that Why do we need AppEngineTokenSource to work on Managed VMs? The |
To minimize the API fragmentation between the classic App Engine and the Managed VMs.
We originally considered providing a TokenSource from the appengine package but the oauth2 package was not mature enough for being such a core dependency. The user should never care about the internals and switching back and forth between different TokenSource implementations if they are on AppEngine. That's what AppEngineTokenSource promises. If we can't maintain the complexity of the appengine TokenSources in the scope of oauth2, let's move them elsewhere. If we provide a half broken library and continuously suggest workarounds, it doesn't help the users. |
I think the correct thing to do is just use It's possible AppEngineTokenSource should be deprecated. |
When we deprecated the old OAuth package (goauth2), we made a compatibility promise not to break any users, e.g. we made several sacrifices along the way to keep the APIs at the cost of not breaking the users. The same policy still applies. We don't break our users randomly or favoring the DefaultClient suddenly by breaking the existing implementations. If the default credentials flow is what is recommended by the App Engine team, we can document it accordingly and tweak the current TokenSource implementation to delegate the work to the DefaultTokenSource. Panicing is agreessive. |
I agree. This (submitted) CL fixes that: I'll file an internal bug about |
@broady, thanks! |
When I use
gcloud preview app run
instead ofgoapp ...
I am unable to access appengine apis due toAppEngineTokenSource(context, scope)
error. AppEngineTokenSource seems to fail because appengineTokenFunc is nil, which causes a panic.I suspect this is because the latest gcloud tool's
gcloud preview app run
isn't actually using docker (and so isn't using the go-wrapper which would set the -tags to appenginevm), it just launches via dev_appserver.py. And the gcloud tool (not leveraging docker, go-wrapper -tags) results in no build tag, which would result in appengine_hook not being compiled in and a nilappEngineTokenFunc
. As an aside, -when I'm coding on the java side of things- I believe thatmvn gcloud:run
does result in running dockers).Error:
CRITICAL: panic: google: AppEngineTokenSource can only be used on App Engine.
I'm thinking that this is a side-effect of an issue the gcloud tool, but I figured I'd post here in case someone had some valuable insight. I appreciate it.
The text was updated successfully, but these errors were encountered: