question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generating changelog: Cannot read property 'trim' of undefined

See original GitHub issue

Hi,

I was trying out this action on this workflow and got an error during the generation of the changelog. This was the first time running this action. Prior to running it, I tagged 0f47f15ad738972fe7104645639aceb3da94aa21 as latest to reduce the number of commits taken into account for the changelog.

Generating changelog
  Adding commit "Bump MSTest.TestFramework from 2.0.0 to 2.1.0" to the changelog
  Adding commit "Bump Microsoft.NET.Test.Sdk from 16.4.0 to 16.5.0" to the changelog
  ##[error]Cannot read property 'trim' of undefined
  (node:3432) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'trim' of undefined
      at e.exports (D:\a\_actions\marvinpinto\action-automatic-releases\latest\dist\index.js:1:572296)
      at Function.e.exports.sync (D:\a\_actions\marvinpinto\action-automatic-releases\latest\dist\index.js:1:570888)
      at D:\a\_actions\marvinpinto\action-automatic-releases\latest\dist\index.js:1:222656
      at Generator.next (<anonymous>)
      at s (D:\a\_actions\marvinpinto\action-automatic-releases\latest\dist\index.js:1:221551)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
  (node:3432) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
  (node:3432) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
svsoolcommented, Nov 1, 2020

Got the same problem https://github.com/svsool/vscode-memo/runs/1336476423 (debug enabled).

Looks like it’s coming from conventional-commits-parser:

⇣6% ❯ node index.js
.../node_modules/conventional-commits-parser/lib/parser.js:152
    while (!header.trim()) {
                   ^

TypeError: Cannot read property 'trim' of undefined
    at parser (.../node_modules/conventional-commits-parser/lib/parser.js:152:20)
    at sync (.../node_modules/conventional-commits-parser/index.js:97:10)
    at Object.<anonymous> (/index.js:7:13)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

Here is the way to repro it:

const { sync } = require("conventional-commits-parser");

console.log(
  sync("Merge pull request #134 from mgmeyers/syntax-decor-flag", {
    mergePattern: "^Merge pull request #(.*) from (.*)$",
    mergeCorrespondence: ["issueId", "source"],
  })
);

Perhaps parser expects multiline message for merge commits. I amended the commit message with two lines instead of one, and build went through.

Not sure if it should be reported to the author of conventional-commits-parser or parsing of merge commit messages can be disabled as part of the action logic.

I also noticed that you mutate imported options here, probably spread can be used instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'trim' of undefined in Jquery - Stack ...
You're getting error. Uncaught TypeError: Cannot read property 'trim' of undefined in Jquery. that means, the variable vname is undefined .
Read more >
TypeError: Cannot read property 'trim' of Undefined in JS
The "Cannot read property 'trim' of undefined" error occurs when calling the trim() method on an undefined value. To solve the error, initialize...
Read more >
cannot read properties of null (reading 'trim') - You.com
First thing you need to see why req.body.text is null or undefined, then you do the empty check like below.
Read more >
Uncaught TypeError: Cannot read property 'trim' of undefined
For a site i get this error from the google console. Uncaught TypeError: Cannot read property 'trim' of undefined at $.AviaMapsAPI._infoWindow ( ...
Read more >
How to fix error Cannot read property 'trim` of undefined ...
[Solved]-How to fix error Cannot read property 'trim` of undefined-discord.js ... The args[3] is null or undefined in the args array. you should...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found