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

Receiving error "Author Name cannot be empty" when pushing to repository #74

Closed
rossmcdonald opened this issue Aug 27, 2019 · 10 comments

Comments

@rossmcdonald
Copy link
Contributor

commented Aug 27, 2019

Describe the bug
Seeing an intermittent error when trying to push to a remote project where the message "Author Name cannot be empty" is produced. Unfortunately it's not clear why this error is caused or how to reproduce it.

To Reproduce

  1. Try to push to remote

Expected behavior
To push to the remote.

Workaround
Refresh the screen.

Screenshots
image

Environment (remove any that are not applicable):

  • Studio version: web, latest production as of 2019.08.27
@rossmcdonald

This comment has been minimized.

Copy link
Contributor Author

commented Aug 27, 2019

/cc @wmhilton

@wmhilton

This comment has been minimized.

Copy link
Member

commented Aug 27, 2019

Debugging info:
according to collin:
app-gen3 commit b6e2ec4
api-gen3 commit e40c4de

thus studio version is 1.0.1

thus the code I'm thinking about is authorName

  @computed
  public get authorName() {
    // use name set in .git/config
    if (this._authorName !== void 0) {
      return this._authorName;
    }
    // use name associated with externalService
    if (this._projectStore.externalUser && this._projectStore.externalUser.name) {
      return this._projectStore.externalUser.name;
    }
    // use username associated with externalService
    if (this._projectStore.externalUser && this._projectStore.externalUser.username) {
      return this._projectStore.externalUser.username;
    }
    // use username associated with Stoplight account
    if (this._userStore.authorizedUser) {
      return this._userStore.authorizedUser.username;
    }
    // we should really never reach this point given our current design requires authentication before
    // creating a commit. But in case the UX wants it or something...
    return '';
  }
  public set authorName(value: Optional<string>) {
    this._authorName = value;
  }

I don't see where it could be coming from frankly. There's a small but finite chance the user could have a .git/config file explicitly with an empty name... I could guard against that, but I don't think that's the cause here. There must be something falling short inside the externalUser or authorizedUser. I just don't think it's possible for them all to be blank. authorizedUser.username surely can't be blank.

@wmhilton

This comment has been minimized.

Copy link
Member

commented Aug 27, 2019

@casserni you know more about externalUser and authorizedUser any ideas?

@wmhilton

This comment has been minimized.

Copy link
Member

commented Aug 27, 2019

Because my best idea so far is to add more logging so we can observe the error better when it happens. I've no idea how to reproduce the error.

@casserni

This comment has been minimized.

Copy link
Member

commented Aug 27, 2019

Not certain off the top of my head, my guess is that this._authorName is being set to an empty string somewhere since '' !== void 0 ==> true, maybe we should update that conditional to be something like if(_.trim(this._authorName))

@wmhilton

This comment has been minimized.

Copy link
Member

commented Aug 27, 2019

I ruled that out though because the only place _authorName is ever set is here in stores/git/git.ts:

          if (name) {
            this._authorName = name;
          }

so setting it to an empty string could never happen. Hence, my conviction it's in the externalUser or authorizedUser

@wmhilton

This comment has been minimized.

Copy link
Member

commented Aug 27, 2019

The reason it's '' !== void 0 by the way was so that _authorName could temporarily be an empty string in the UX. If the user was editing their authorName and did a Ctrl+A + Backspace, the text field wouldn't immediately be replaced with one of the fallback usernames. This is obviously not a problem now that the authorName isn't configurable.

@wmhilton

This comment has been minimized.

Copy link
Member

commented Aug 27, 2019

Alrighty, we're updating production to log more stuff if this error happens (hopefully!). Next time it happens, open the console and if there is a line that says CANNOT FIND AUTHOR NAME! TRIED: screengrab all the logged stuff.

@casserni casserni self-assigned this Aug 29, 2019

@rossmcdonald

This comment has been minimized.

Copy link
Contributor Author

commented Aug 30, 2019

It seems this error is triggered by a certain order of events in the UI, and should be resolved by refreshing the window.

@marbemac

This comment has been minimized.

Copy link
Member

commented Aug 30, 2019

I know how to reproduce, can fix this weekend.

  1. load studio web while logged out (so that studio store is initialized with empty user token)
  2. login
  3. open new project
  4. try to commit, authorized user not set yet so no author

@marbemac marbemac assigned marbemac and unassigned casserni Aug 30, 2019

@marbemac marbemac added this to the Aug '19 Hardening milestone Sep 3, 2019

@marbemac marbemac closed this Sep 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.