-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
Auto discovery not working similar to v4.x #210
Comments
Thank you for the detailed issue description and for sharing your investigations! While looking at the differences between the latest 4.x and 5.x versions, I noticed that, in 9f9aa5b, I removed the option to disable credentials auto-discovery - this shouldn't™ be the reason, but just to be sure, in your preferred setup, could you check if you have set the Also, this commit changed the way how the service account is set. It should be working with a fallback, but perhaps there's something we missed. Another thing: since this is happening during the Finally, the regression could come from the underlying SDK that also jumped major releases. But since it's used in so many projects, I believe the problem would have been reported earlier already. I don't currently have the resources to test this myself but let me know if/what you find out, be it just for rubber duck debugging. |
Hey @jeromegamez thanks for the reply. Let me go back through those changes and see if I can find where the issue is occurring and I'll try to mount the credentials directly in the container locally and debug it. We do the package discovery once we have credentials mounted due to Firebase requiring this otherwise we would do it prior when we build the container. Also, the credentials are available otherwise so I think mounting has been completed prior to this as well. I was thinking it may be the underlying SDK but I couldn't see anyone else having the same issues so I figured may as well start at the top and work my way down. I'll report back with what I find, I'm happy to try and do a PR for this too. |
same problem here... |
So, there I was, sitting on my terrace, enjoying the evening sun, when suddenly it hit me out of nowhere: While doing a refactoring of the SDK, if I remember correctly, I moved the auto discovery into the constructor of the Factory instead of invoking it on the fly. If I did (I have to check), I'll re-refactor it - hopefully, together with making the service provider deferred, this will fix the issue. Another thing that came to me: the missing client email field error indicates that there is a JSON file, I wonder what it is and where it comes from. But again, I'll check if my assumption is correct, actually upon it and let you know when you can test it - if you're still available and haven't given up on the package/the SDK 😅 |
Could you please upgrade 5.9.1 and let me know if this solves the issue for you? 🙏🏻 |
I'm closing the issue for now as I believe it is fix. I'll be happy to reopen it in case it isn't, but I hope for the best 🤞🏻 |
Describe the bug
Hi guys!
Firstly, thanks for supporting this, I really appreciate it.
I'm using Firebase in a personal project which I deploy via a docker container deployed on a GCE instance. I was previously relying on the auto discovery of the service account credentials on GCE when running
v4.x
of the package but since upgrading tov5.x
, I've been unable to get it to work.Installed packages
PHP version and extensions
Steps to reproduce the issue.
How I used to authenticate when using 4.x
I have a service account attached to my GCE instance which I provide all of the roles that it needs to be able to run. I have a need for other containers to be running but this is the only one which requires GCP services so I wanted to use the default credentials.
I was able to authenticate by directly mounting the
$HOME/.config/gcloud
config directly to the path via my docker-compose file using/root/.config/gcloud:ro
inside of my container which worked perfectly.How I've tried to authenticate since upgrading to 5.x
I checked that inside my container I was able to interact with the GCP metadata server and be able to generate all the correct tokens that I would need to be able to authenticate but I was unable to figure out why it was trying to search for a json value of
client_email
when I was expecting that to be a part of the service discovery.To test this, I decided to try and generate the default_application_credentials.json via
gcloud auth application-default login
file and still mount the~/.config/gcloud
folder directly to/root/.config/gcloud
to my docker container. This didn't work out of the box even though it was considered a well known file path which I found really odd.After reading through the source code, I noticed that google/auth was trying to read from
$HOME/.config/gcloud/application_default_credentials.json
and I checked my dockerfile to see that I have a USER configured calledwww
so I also tested to see whether I could directly mount it to/home/www/.config/gcloud
as this would resolve the$HOME
variable correctly and it still didn't work. Something to note is that even before, I was only setting it to the /root directory and it was working fine.GOOGLE_APPLICATION_CREDENTIALS
environment variableI generate a key via the GCP console and mount that directly to the container via
/root/.config/gcloud/application_default_credentials.json
and that ends up working perfectly yet GCP doesn't recommend doing this as long lasting keys are not secure.Error message/Stack trace
The text was updated successfully, but these errors were encountered: