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.

TypeError: VALIDATORS[option] is not a function

See original GitHub issue

This popped up today. Was working fine last week.

My release.config.js looks like

        [
            "@semantic-release/gitlab",
            {
                successComment: false
            }
        ],
$ npx semantic-release
[8:55:36 AM] [semantic-release] › ℹ  Running semantic-release version 19.0.2
[8:55:37 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/gitlab"
[8:55:37 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "semantic-release-slack-bot"
[8:55:37 AM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[8:55:37 AM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[8:55:37 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/gitlab"
[8:55:37 AM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/gitlab"
[8:55:37 AM] [semantic-release] › ✔  Loaded plugin "success" from "semantic-release-slack-bot"
[8:55:37 AM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/gitlab"
[8:55:37 AM] [semantic-release] › ✔  Loaded plugin "fail" from "semantic-release-slack-bot"
[8:55:37 AM] [semantic-release] › ✔  Run automated release from branch staging on repository https://gitlab-ci-token:[secure]@gitlab-ext.cu.be/henne/oms.git
[8:55:38 AM] [semantic-release] › ✔  Allowed to push to the Git repository
[8:55:38 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "@semantic-release/gitlab"
[8:55:38 AM] [semantic-release] › ✖  Failed step "verifyConditions" of plugin "@semantic-release/gitlab"
[8:55:38 AM] [semantic-release] › ℹ  Start step "verifyConditions" of plugin "semantic-release-slack-bot"
[8:55:38 AM] [semantic-release] › ✔  Completed step "verifyConditions" of plugin "semantic-release-slack-bot"
[8:55:38 AM] [semantic-release] › ✖  An error occurred while running semantic-release: TypeError: VALIDATORS[option] is not a function
    at /builds/henne/oms/node_modules/@semantic-release/gitlab/lib/verify.js:37:[43](https://gitlab-ext.cu.be/henne/oms/-/jobs/67701#L43)
    at Array.reduce (<anonymous>)
    at module.exports (/builds/henne/oms/node_modules/@semantic-release/gitlab/lib/verify.js:35:[47](https://gitlab-ext.cu.be/henne/oms/-/jobs/67701#L47))
    at verifyConditions (/builds/henne/oms/node_modules/@semantic-release/gitlab/index.js:11:9)
    at validator (/builds/henne/oms/node_modules/semantic-release/lib/plugins/normalize.js:34:30)
    at /builds/henne/oms/node_modules/semantic-release/lib/plugins/pipeline.js:37:40
    at next (/builds/henne/oms/node_modules/p-reduce/index.js:17:9)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  pluginName: '@semantic-release/gitlab'
}
AggregateError: 
    TypeError: VALIDATORS[option] is not a function
        at /builds/henne/oms/node_modules/@semantic-release/gitlab/lib/verify.js:37:43
        at Array.reduce (<anonymous>)
        at module.exports (/builds/henne/oms/node_modules/@semantic-release/gitlab/lib/verify.js:35:47)
        at verifyConditions (/builds/henne/oms/node_modules/@semantic-release/gitlab/index.js:11:9)
        at validator (/builds/henne/oms/node_modules/semantic-release/lib/plugins/normalize.js:34:30)
        at /builds/henne/oms/node_modules/semantic-release/lib/plugins/pipeline.js:37:40
        at next (/builds/henne/oms/node_modules/p-reduce/index.js:17:9)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at /builds/henne/oms/node_modules/semantic-release/lib/plugins/pipeline.js:[54](https://gitlab-ext.cu.be/henne/oms/-/jobs/67701#L54):11
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.pluginsConf.<computed> [as verifyConditions] (/builds/henne/oms/node_modules/semantic-release/lib/plugins/index.js:80:11)
    at async run (/builds/henne/oms/node_modules/semantic-release/index.js:103:3)
    at async module.exports (/builds/henne/oms/node_modules/semantic-release/index.js:268:22)
    at async module.exports (/builds/henne/oms/node_modules/semantic-release/cli.js:[55](https://gitlab-ext.cu.be/henne/oms/-/jobs/67701#L55):5)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
JonasSchubertcommented, Apr 13, 2022

I think we can either check whether an validator exists here. E.g.:

      !isNil(value) && (!VALIDATORS[option] || !VALIDATORS[option](value)) 

Or (in my opinion better) we add the missing validators here. I think the missing validators are milestones and successComment. E.g.:

const VALIDATORS = {
  assets: isArrayOf(
    asset => isStringOrStringArray(asset) || (isPlainObject(asset) && isStringOrStringArray(asset.path))
  ),
  milestones: isArrayOf(
    milestone => isStringOrStringArray(milestone)
  ),
  successComment: canBeDisabled(isNonEmptyString),
  failTitle: canBeDisabled(isNonEmptyString),
  failComment: canBeDisabled(isNonEmptyString),
  labels: isNonEmptyString,
  assignee: isNonEmptyString,
};

Or remove the generic validator check and do each validation separately.

PS: thanks @fgreinacher for looking into it and sorry for the trouble

1reaction
fgreinachercommented, Apr 13, 2022

I’ll have a look tomorrow (before leaving for vacation 😀)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 2 Typescript: TypeError: this.validator is not a function
I had this error when I was binding an array of values in form builder the wrong way. What I did: fb.group({items: [1,...
Read more >
TypeError: this._validator is not a function #30784 - GitHub
The OnChange loop seems to call validate before setting the attributes, and then call it again after setting the attributes. There are three ......
Read more >
TypeError: this.validator is not a function - Ionic Forum
validator is not a function. I'm iterating through an array of records to dynamically create formGroups for the frontend. I've achieved this in ......
Read more >
[Solved] Jquery validate is not a function - CodeProject
This error occurs when the jQuery validation plugin is not loaded or the jQuery-related scripts are loaded in an incorrect order. Please check ......
Read more >
$(...).validate is not a function. Client side validation - MSDN
Answered by: locked. Uncaught TypeError: $(...).validate is not a function. Client side validation ...
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