Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: VALIDATORS[option] is not a function #363

Closed
hvanoch opened this issue Apr 13, 2022 · 7 comments · Fixed by #364
Closed

TypeError: VALIDATORS[option] is not a function #363

hvanoch opened this issue Apr 13, 2022 · 7 comments · Fixed by #364

Comments

@hvanoch
Copy link

hvanoch commented Apr 13, 2022

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)
@fgreinacher
Copy link
Contributor

fgreinacher commented Apr 13, 2022

@JonasSchubert Looks related to #349, could you have a look?

@JonasSchubert
Copy link
Contributor

@fgreinacher will do so on the coming weekend.
Could be related to missing validator for successComment. I forgot that. And will check if anything else is missing.

@travi
Copy link
Member

travi commented Apr 13, 2022

is it worth reverting the problematic implementation in the meantime so that a working patch version can be released?

@JonasSchubert
Copy link
Contributor

If it is urgent maybe. I'm on vacation and unfortunately without prober computer. Saturday is the earliest I can work on it

@fgreinacher
Copy link
Contributor

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

@JonasSchubert
Copy link
Contributor

JonasSchubert commented 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

@github-actions
Copy link

🎉 This issue has been resolved in version 9.1.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

4 participants