Skip to content

promisify crashing node #525

Closed
Closed
@SamMousa

Description

@SamMousa

I have several different packages where semantic release is no longer working.
The last line in the log is this:

[3:27:11 PM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"

The exit code is 0 so my pipelines proceed but no release is created.
This happens on several repositories, most open source, I'll link some CI traces here:

The code causing this issue lives in load-parser-config.js:

export default async ({ preset, config, parserOpts, presetConfig }, { cwd, logger }) => {
  let loadedConfig;
  const __dirname = dirname(fileURLToPath(import.meta.url));

  if (preset) {
    const presetPackage = `conventional-changelog-${preset.toLowerCase()}`;
    loadedConfig = importFrom(cwd, presetPackage);
  } else if (config) {
    loadedConfig = importFrom.silent(__dirname, config) || importFrom(cwd, config);
  } else {
    loadedConfig = conventionalChangelogAngular;
  }

  // Comments added by @sammousa. 
  // loadedConfig is an async function, specifically the createPreset export from conventional-changelog-conventionalcommits package
  // which implements the conventional commit standard that this package uses
  loadedConfig = await (typeof loadedConfig === "function"
      ? isPlainObject(presetConfig)
          ? loadedConfig(presetConfig)
          // this line crashes nodejs silently when called with an async function
          : promisify(loadedConfig)()
      : loadedConfig);

  return { ...loadedConfig.parserOpts, ...parserOpts };
};

The bug is definitely in nodeJS, the fix for this package however would be to not use promisify at all, since we're calling the function directly if there IS a configuration, why not also call it directly when there isn't?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions