ashish10alex / vscode-dataform-tools

Dataform tools - a vscode extension
https://marketplace.visualstudio.com/items?itemName=ashishalex.dataform-lsp-vscode
MIT License
20 stars 4 forks source link

Feature: re-created authentication handler for BigQuery #60

Closed benjaminwestern closed 5 days ago

benjaminwestern commented 5 days ago

This should 100% resolve the issues experienced in: Issue 53

ashish10alex commented 5 days ago

Hi @benjaminwestern , Thanks for the PR, this is definitely in the right direction. I have added some comments to hopefully make the implementation better

benjaminwestern commented 5 days ago

@ashish10alex added an isAuthenticated flag and a seperate verifyAuthentication and checkAuthentication functions

benjaminwestern commented 5 days ago

@ashish10alex I have also now added the ability for the user to determine if they want an interval type check (by default) or if they would instead prefer to only attempt to recreate the client on error

HampB commented 5 days ago

Thanks for the additions, @benjaminwestern

When unauthenticated and performing a dry-run, the following error messages are now displayed:

Error message 1
Error message 2

Error creating BigQuery client: Error: Unable to detect a Project Id in the current environment. To learn more about authentication and Google APIs, visit: https://cloud.google.com/docs/authentication/getting-started

If the issue is authentication-related, I suggest refining the message "BigQuery client not available" to be more descriptive. For example:

"Could not initiate a connection to BigQuery. Please ensure you are authenticated and try again. How to authenticate with ADC"

This would provide clearer guidance to users encountering authentication issues.

benjaminwestern commented 5 days ago

Thanks @HampB I will update the returned text based on a forbidden vs an expired or non-active ADC

ashish10alex commented 5 days ago

Thanks a lot @benjaminwestern , I tested this again and looks good to me. I'll merge the PR now. We can revisit the above error message semantics later after we have some real world usage plus if any new user complains of them being unintuitive.


Also, thanks @HampB for the help with the review :)