Skip to content
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

dart pub login fails with exception "type Null is not a subtype of type String" #3436

Closed
bartekpacia opened this issue May 25, 2022 · 1 comment
Labels
closed-duplicate Closed in favor of an existing report

Comments

@bartekpacia
Copy link

bartekpacia commented May 25, 2022

This is my first time trying to do dart pub login and this is what I'm getting. Tried a few times.

$ dart pub login
Pub needs your authorization to upload packages on your behalf.
In a web browser, go to https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&response_type=code&client_id=818368855108-8grd2eg9tj9f38os6f1urbcvsq399u8n.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A61495&code_challenge=G6jSZhqbO86C4WrXGeyNBibKWCfA7mLLJyC9boJI9tQ&code_challenge_method=S256&scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email
Then click "Allow access".

Waiting for your authorization...
Authorization received, processing...
Successfully authorized.
type 'Null' is not a subtype of type 'String'
package:pub/src/command/login.dart 50:34  LoginCommand._retrieveUserInfo.<fn>
===== asynchronous gap ===========================
package:pub/src/command/login.dart 42:12  LoginCommand._retrieveUserInfo
===== asynchronous gap ===========================
package:pub/src/command/login.dart 28:24  LoginCommand.runProtected
This is an unexpected error. The full log and other details are collected in:

    /Users/bartek/.pub-cache/log/pub_log.txt

Consider creating an issue on https://github.com/dart-lang/pub/issues/new
and attaching the relevant parts of that log file.
pub finished with exit code 1
Logs
  Information about the latest pub run.

If you believe something is not working right, you can go to 
https://github.com/dart-lang/pub/issues/new to post a new issue and attach this file.

Before making this file public, make sure to remove any sensitive information!

Pub version: 2.17.1
Created: 2022-05-25T15:17:16.264647
FLUTTER_ROOT: /Users/bartek/fvm/versions/stable
PUB_HOSTED_URL: <not set>
PUB_CACHE: "<not set>"
Command: dart pub login
Platform: macos

---- Log transcript ----
FINE: Pub 2.17.1
FINE: Loading OAuth2 credentials.
FINE: Loading OAuth2 credentials.
MSG : Pub needs your authorization to upload packages on your behalf.
    | In a web browser, go to https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&response_type=code&client_id=818368855108-8grd2eg9tj9f38os6f1urbcvsq399u8n.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A61588&code_challenge=ieJ1-CaTT56tZdbu2x3JN7W8YgXLYs2P01k5Sqz8vsQ&code_challenge_method=S256&scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email
    | Then click "Allow access".
    | 
    | Waiting for your authorization...
MSG : Authorization received, processing...
IO  : HTTP POST https://accounts.google.com/o/oauth2/token
    | content-type: application/x-www-form-urlencoded; charset=utf-8
    | user-agent: Dart pub 2.17.1
IO  : HTTP response 200 OK for POST https://accounts.google.com/o/oauth2/token
    | took 0:00:00.184359
    | cache-control: no-cache, no-store, max-age=0, must-revalidate
    | date: Wed, 25 May 2022 13:17:16 GMT
    | transfer-encoding: chunked
    | content-encoding: gzip
    | vary: Origin,X-Origin,Referer
    | content-type: application/json; charset=utf-8
    | pragma: no-cache
    | x-xss-protection: 0
    | server: scaffolding on HTTPServer2
    | alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
    | x-frame-options: SAMEORIGIN
    | x-content-type-options: nosniff
    | expires: Mon, 01 Jan 1990 00:00:00 GMT
MSG : Successfully authorized.
IO  : HTTP GET https://accounts.google.com/.well-known/openid-configuration
    | user-agent: Dart pub 2.17.1
IO  : HTTP response 200 OK for GET https://accounts.google.com/.well-known/openid-configuration
    | took 0:00:00.022333
    | last-modified: Thu, 16 Jan 2020 21:53:16 GMT
    | cache-control: public, max-age=3600
    | access-control-allow-origin: *
    | date: Wed, 25 May 2022 12:45:33 GMT
    | vary: Accept-Encoding
    | age: 1903
    | report-to: {"group":"federated-signon-mpm-access","max_age":2592000,"endpoints":[{"url":"https://csp.withgoogle.com/csp/report-to/federated-signon-mpm-access"}]}
    | content-type: application/json
    | cross-origin-opener-policy: same-origin; report-to="federated-signon-mpm-access"
    | x-xss-protection: 0
    | server: sffe
    | content-security-policy-report-only: require-trusted-types-for 'script'; report-uri https://csp.withgoogle.com/csp/federated-signon-mpm-access
    | alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
    | accept-ranges: bytes
    | content-length: 1280
    | x-content-type-options: nosniff
    | expires: Wed, 25 May 2022 13:45:33 GMT
IO  : HTTP GET https://openidconnect.googleapis.com/v1/userinfo
    | authorization: <censored>
    | user-agent: Dart pub 2.17.1
IO  : HTTP response 200 OK for GET https://openidconnect.googleapis.com/v1/userinfo
    | took 0:00:00.114609
    | cache-control: no-cache, no-store, max-age=0, must-revalidate
    | date: Wed, 25 May 2022 13:17:16 GMT
    | transfer-encoding: chunked
    | content-encoding: gzip
    | vary: Origin,X-Origin,Referer
    | content-type: application/json; charset=utf-8
    | pragma: no-cache
    | x-xss-protection: 0
    | server: ESF
    | alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
    | x-frame-options: SAMEORIGIN
    | x-content-type-options: nosniff
    | expires: Mon, 01 Jan 1990 00:00:00 GMT
FINE: Saving OAuth2 credentials.
IO  : Writing 1373 characters to text file /Users/bartek/Library/Application Support/dart/pub-credentials.json.
ERR : type 'Null' is not a subtype of type 'String'
FINE: Exception type: _TypeError
ERR : package:pub/src/command/login.dart 50:34  LoginCommand._retrieveUserInfo.<fn>
    | ===== asynchronous gap ===========================
    | package:pub/src/command/login.dart 42:12  LoginCommand._retrieveUserInfo
    | ===== asynchronous gap ===========================
    | package:pub/src/command/login.dart 28:24  LoginCommand.runProtected
ERR : This is an unexpected error. The full log and other details are collected in:
    | 
    |     /Users/bartek/.pub-cache/log/pub_log.txt
    | 
    | Consider creating an issue on https://github.com/dart-lang/pub/issues/new
    | and attaching the relevant parts of that log file.
---- End log transcript ----
@bartekpacia bartekpacia changed the title type Null is not a subtype of type String dart pub login fails with exception "type Null is not a subtype of type String" May 25, 2022
@sigurdm
Copy link
Contributor

sigurdm commented May 31, 2022

Thanks for reporting, duplicate of #3424 .

@sigurdm sigurdm closed this as completed May 31, 2022
@jonasfj jonasfj added the closed-duplicate Closed in favor of an existing report label May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

3 participants