Skip to content

TypeError: Method Date.prototype.toString called on incompatible receiver [object Date] #675

Closed
@ethanneff

Description

@ethanneff

I got this error

[5:40:14 PM] [semantic-release] › ✘  Failed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[5:40:14 PM] [semantic-release] › ✘  An error occurred while running semantic-release: TypeError: Method Date.prototype.toString called on incompatible receiver [object Date]
    at Proxy.toString (<anonymous>)
    at [Symbol.toPrimitive] (<anonymous>)
    at new Date (<anonymous>)
    at Object.formatDate (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/utils.js:8:12)
    at defaultCommitTransform (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/options.js:23:23)
    at transformCommit (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/commit.js:29:23)
    at write (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/writers.js:39:28)
    at async nextAsync (node:internal/streams/from:182:33) {
  pluginName: '@semantic-release/release-notes-generator'
}
TypeError: Method Date.prototype.toString called on incompatible receiver [object Date]
    at Proxy.toString (<anonymous>)
    at [Symbol.toPrimitive] (<anonymous>)
    at new Date (<anonymous>)
    at Object.formatDate (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/utils.js:8:12)
    at defaultCommitTransform (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/options.js:23:23)
    at transformCommit (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/commit.js:29:23)
    at write (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/writers.js:39:28)
    at async nextAsync (node:internal/streams/from:182:33) {
  pluginName: '@semantic-release/release-notes-generator'
}error Command failed with exit code 1.

when upgrading:

  • from "@semantic-release/release-notes-generator": "13.0.0",
  • to "@semantic-release/release-notes-generator": "14.0.0",

my release config looks like this

module.exports = {
  branches: ['main'],
  plugins: [
    [
      '@semantic-release/commit-analyzer',
      {
        releaseRules: [
          { type: 'refactor', release: 'patch' },
          { type: 'docs', scope: 'README', release: 'patch' },
          { type: 'test', release: 'patch' },
          { type: 'style', release: 'patch' },
          { type: 'perf', release: 'patch' },
          { type: 'ci', release: 'patch' },
          { type: 'build', release: 'patch' },
          { type: 'chore', release: 'patch' },
          { type: 'no-release', release: false },
        ],
        parserOpts: {
          noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'],
        },
      },
    ],
    [
      '@semantic-release/release-notes-generator',
      {
        preset: 'conventionalcommits',
        presetConfig: {
          types: [
            { type: 'feat', section: ':sparkles: Features', hidden: false },
            { type: 'fix', section: ':bug: Fixes', hidden: false },
            { type: 'docs', section: ':memo: Documentation', hidden: false },
            { type: 'style', section: ':barber: Code-style', hidden: false },
            { type: 'refactor', section: ':zap: Refactor', hidden: false },
            {
              type: 'perf',
              section: ':fast_forward: Performance',
              hidden: false,
            },
            {
              type: 'test',
              section: ':white_check_mark: Tests',
              hidden: false,
            },
            { type: 'ci', section: ':repeat: CI', hidden: false },
            { type: 'chore', section: ':repeat: Chore', hidden: false },
          ],
        },
      },
    ],
    ['@semantic-release/npm', { npmPublish: false }],
    ['@semantic-release/github', { successComment: false, failComment: false }],
    [
      '@semantic-release/changelog',
      { changelogFile: '.github/CHANGELOG.md', changelogTitle: '# Changelog' },
    ],
    [
      '@semantic-release/git',
      {
        assets: ['.github/CHANGELOG.md', 'package.json'],
        message: 'chore(release): ${nextRelease.version} [skip ci]',
      },
    ],
  ],
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions