fix(auth): make googleapis_auth web-compatible by removing transitive dart:io imports#749
Conversation
… dart:io imports - Replace the import of `../auth_io.dart` in `auth_client.dart` with `access_credentials.dart` to avoid importing `dart:io` on the web. - Introduce conditional imports for `serviceAccountEmailFromMetadataServer` in `auth_client_signing_extension.dart` and `iam_signer.dart`. This prevents importing `package:google_cloud` (which depends on `dart:io`) on the web, while retaining full functionality on the Dart VM. - Document that GCE metadata server fallback/querying is unsupported on the web and throws UnsupportedError, meaning `serviceAccountEmail` is required on the web for signing. - Update CHANGELOG.md and bump version to 2.3.2.
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
PR HealthAPI leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with Unused Dependencies ✔️
For details on how to fix these, see dependency_validator. This check can be disabled by tagging the PR with License Headers ✔️
All source files should start with a license header. This check can be disabled by tagging the PR with Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with Breaking changes ✔️
This check can be disabled by tagging the PR with |
srujzs
left a comment
There was a problem hiding this comment.
Thanks! I think it's better than the current state in 2.3.1, but if we're going the conditional import route, can we not just split out the APIs that can only be run on the VM into a separate file and have that be exported by auth_io.dart?
I believe that would be a breaking change to APIs like sign though.
Yep! This is the less breaking version of what we already shipped. Need to follow-up with the breaking change. I'll update the commit message to NOT close the issue! |
../auth_io.dartinauth_client.dartwithaccess_credentials.dartto avoid importingdart:ioon the web.serviceAccountEmailFromMetadataServerinauth_client_signing_extension.dartandiam_signer.dart. This prevents importingpackage:google_cloud(which depends ondart:io) on the web, while retaining full functionality on the Dart VM.serviceAccountEmailis required on the web for signing.Fixes #746