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

Error: Cannot read property 'login' of null #187

Open
wottpal opened this issue Jun 20, 2022 · 16 comments
Open

Error: Cannot read property 'login' of null #187

wottpal opened this issue Jun 20, 2022 · 16 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@wottpal
Copy link

wottpal commented Jun 20, 2022

While deploying I get the following error, do you have any ideas?

Error: Cannot read property 'login' of null

Screen Shot 2022-06-21 at 01 26 07

The deploy script is basically copy'n'paste from the docs:

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Deploy to Vercel CI

on:
  workflow_dispatch:
  push:
    branches: [develop]

jobs:
  deploy:
    runs-on: ubuntu-latest
    if: "!contains(github.event.head_commit.message, '[skip ci]')"
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Deploy
        uses: BetaHuhn/deploy-to-vercel-action@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GH_PAT }}
          VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
          VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
          VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
          PRODUCTION: false
@wottpal wottpal added the bug Something isn't working label Jun 20, 2022
@sebastianst
Copy link

May it be the case that the user whose token is used in the action also needs to have a fork of the repo?

It looks like in file github.js there's a client created with

	const client = github.getOctokit(GITHUB_TOKEN, { previews: [ 'flash', 'ant-man' ] })

which then operates under the user. Further down in the file, the property login is read from data obtained by calling client.repos.getCommit.

@BetaHuhn BetaHuhn added the help wanted Extra attention is needed label Jun 21, 2022
@BetaHuhn
Copy link
Owner

If anyone else is facing this issue, pinning the action to v1.9.0 is a temporary work around confirmed by @wottpal (yieldgate/yieldgate#14 (comment))

The issue might be caused by one of the last dependency updates which broke something internal, will take a closer look sometime this week.

@luiscaro1
Copy link

I did the workaround and still getting the same error @BetaHuhn
Screen Shot 2022-07-09 at 2 51 14 PM

@airtonix
Copy link

yep also getting this error

@airtonix
Copy link

airtonix commented Aug 15, 2022

@BetaHuhn I'm not sure but would this be something to do with how you request the api features?

I'm having trouble finding documentation about this aspect on github.

  1. highlighted github.getOctokit and google searched it, resulting in this page one result: https://github.com/actions/toolkit/blob/main/packages/github/README.md
  2. following the link in there to https://octokit.github.io/rest.js/v18
  3. tried to follow the link in there about api previews: https://octokit.github.io/rest.js/v18#previews 👉🏻 https://docs.github.com/en/rest/overview/api-previews/
  4. land on a page that says nothing about api previews.
  5. ????
  6. confused.

Another thing is, does repos.getCommit actually return an author object containing a login property?

answer: looks like your pulling values from this shape:

{
  "commit": {
    "author": {
      "name": string
    }
  },
  "author": {
    "login": string
  }
}

but if you look at the JSONSchema of that data.author object, it says it can possibly be null.

image

@Elindorath
Copy link
Contributor

I just encountered this issue with my team: some of my colleagues were able to deploy, others not. It drove me crazy! And I refused to believe that the author object could be null for no reason.

But I think I found it, and it is kind of dumb: I noticed that some of my colleagues used an email in their git configuration which was not added to their Github profile. And indeed, after rectification, everything went well!

Hope this can help!

@BetaHuhnBot
Copy link
Collaborator

⚠️ This issue has not seen any activity in the past 2 months so I'm marking it as stale. I'll close it if it doesn't see any activity in the coming week.

@BetaHuhnBot BetaHuhnBot added the wontfix This will not be worked on label Nov 7, 2022
@wottpal
Copy link
Author

wottpal commented Nov 15, 2022

@BetaHuhn should be reopened probably.

@BetaHuhn BetaHuhn reopened this Nov 15, 2022
@BetaHuhnBot BetaHuhnBot removed the wontfix This will not be worked on label Nov 16, 2022
@wottpal
Copy link
Author

wottpal commented Nov 30, 2022

I can fully confirm the finding by @Elindorath. It must be some coincidence that it suddenly worked for me that day.

Can you add this requirement to the Readme, please, @BetaHuhn?

@BetaHuhnBot
Copy link
Collaborator

⚠️ This issue has not seen any activity in the past 2 months so I'm marking it as stale. I'll close it if it doesn't see any activity in the coming week.

@BetaHuhnBot BetaHuhnBot added the wontfix This will not be worked on label Jan 30, 2023
@wottpal
Copy link
Author

wottpal commented Jan 30, 2023

@WebTarantul
Copy link

Fixed by adding an email and name to the .gitconfig file

@krystiankedra
Copy link

Hello, just update from my side, from few days we have the same issue:

  • Error: Cannot read properties of null (reading 'login')

Currently we are using BetaHuhn/[email protected]

We were trying to change version for:
BetaHuhn/[email protected]
BetaHuhn/[email protected]

but the issue was not resolved. What we tried as well is to set:
- name: git_config
env:
GIT_AUTHOR_NAME: hardcoded name
GIT_AUTHOR_EMAIL: hardcoded email
run: |
git config --global user.email "$GIT_AUTHOR_EMAIL"
git config --global user.email "$GIT_AUTHOR_EMAIL"

and it's not working as well. Is there any update about issue?

@jerrywu001
Copy link

I got same issue

@Finnepinnen
Copy link

I used the proposal written by @Elindorath above

Run the following
git config --local user.name "Name on Github"
git config --local user.email "[email protected]"

Then made a small change to a random file and commited, pushed and then it worked!

Maybe this would solve your issues also? @krystiankedra and @jerrywu001

@tmaihoff
Copy link

tmaihoff commented Nov 15, 2023

Ran into the same problem on one machine.

Turned out I had a typo in the git config user.email.

Ran git config --local user.email "use_the_email_for_your_account" as @Finnepinnen suggested which fixed the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests