Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Cannot destructure property login of 'undefined' or 'null'. #24

Open
omjadas opened this issue May 6, 2020 · 7 comments
Open

Cannot destructure property login of 'undefined' or 'null'. #24

omjadas opened this issue May 6, 2020 · 7 comments

Comments

@omjadas
Copy link

omjadas commented May 6, 2020

image

@TheRealWaldo
Copy link

Seeing the same.

@gagan-hotstar
Copy link

same issue

@asbjornu
Copy link

Yeah, same. Here's a publicly available GitHub Actions run with the error:

{
  error: TypeError: Cannot destructure property `login` of 'undefined' or 'null'.
      at /home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:21210
      at Generator.next (<anonymous>)
      at /home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:19906
      at new Promise (<anonymous>)
      at n (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:19654)
      at run (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:20939)
      at Object.131 (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:23551)
      at __webpack_require__ (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:154)
      at startup (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:291)
      at module.exports.0 (/home/runner/work/_actions/cleartax/jira-lint/master/lib/index.js:1:323)
}
Error: Cannot destructure property `login` of 'undefined' or 'null'.

@asbjornu
Copy link

asbjornu commented Feb 14, 2022

It would be a lot easier to debug this problem if a non-minimized version of the action was provided, somehow. If one can be provided (in a separate branch, for instance), I can run against it and give you a new and much more informative stack trace. But it seems like this is the problematic (minimized) expression:

const{payload:{repository:f,organization:{login:y},pull_request:b}}=o.context

If that's correct, this may be the source:

jira-lint/src/main.ts

Lines 64 to 70 in 0b90e54

const {
payload: {
repository,
organization: { login: owner },
pull_request: pullRequest,
},
} = github.context;

@asbjornu
Copy link

I'm not sure, but I believe that this would fix the problem:

diff --git a/src/main.ts b/src/main.ts
index 10d28e9..4b55e79 100755
--- a/src/main.ts
+++ b/src/main.ts
@@ -64,7 +64,6 @@ async function run(): Promise<void> {
     const {
       payload: {
         repository,
-        organization: { login: owner },
         pull_request: pullRequest,
       },
     } = github.context;
@@ -73,7 +72,7 @@ async function run(): Promise<void> {
       throw new Error(`Missing 'repository' from github action context.`);
     }

-    const { name: repo } = repository;
+    const { name: repo, owner: { login: owner } }  = repository;

     const {
       base: { ref: baseBranch },

@asbjornu
Copy link

asbjornu commented Feb 14, 2022

I submitted #55 to fix this problem.

@asbjornu
Copy link

As suggested by @maddhruv in #56 (comment), I've forked and fixed this and a lot of other issues in action-jira-linter.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants