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

CI failing with error - Field 'canBeRebased' doesn't exist on type 'PullRequest' #910

Closed
tejasbagal1 opened this issue Sep 2, 2024 · 11 comments · Fixed by #913
Closed
Assignees
Labels

Comments

@tejasbagal1
Copy link

tejasbagal1 commented Sep 2, 2024

Hello Team,
we use the latest version of semantic-release in our Jenkins pipeline.
After the recent update #874 in this repo, our build is failing with the below error

3:18:06 PM] [semantic-release] › ✔  Completed step "publish" of plugin "@semantic-release/github"
[2024-09-02T19:18:07.347Z] [3:18:06 PM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/exec"
[2024-09-02T19:18:07.347Z] [3:18:06 PM] [semantic-release] › ✔  Completed step "publish" of plugin "@semantic-release/exec"
[2024-09-02T19:18:07.347Z] [3:18:06 PM] [semantic-release] › ℹ  Start step "success" of plugin "@semantic-release/github"
[2024-09-02T19:18:08.812Z] [3:18:08 PM] [semantic-release] › ✘  Failed step "success" of plugin "@semantic-release/github"
[2024-09-02T19:18:08.812Z] [3:18:08 PM] [semantic-release] › ℹ  Start step "success" of plugin "@semantic-release/exec"
[2024-09-02T19:18:08.812Z] [3:18:08 PM] [semantic-release] › ✔  Completed step "success" of plugin "@semantic-release/exec"
[2024-09-02T19:18:08.812Z] [3:18:08 PM] [semantic-release] › ✘  An error occurred while running semantic-release: Error: Field 'canBeRebased' doesn't exist on type 'PullRequest'
[2024-09-02T19:18:08.813Z]     at file:///usr/local/lib/node_modules/semantic-release/node_modules/aggregate-error/index.js:23:26
[2024-09-02T19:18:08.813Z]     at Array.map (<anonymous>)
[2024-09-02T19:18:08.813Z]     at new AggregateError (file:///usr/local/lib/node_modules/semantic-release/node_modules/aggregate-error/index.js:16:19)
[2024-09-02T19:18:08.813Z]     at file:///usr/local/lib/node_modules/semantic-release/lib/plugins/pipeline.js:55:13
[2024-09-02T19:18:08.813Z]     at async pluginsConfigAccumulator.<computed> [as success] (file:///usr/local/lib/node_modules/semantic-release/lib/plugins/index.js:87:11)
[2024-09-02T19:18:08.813Z]     at async run (file:///usr/local/lib/node_modules/semantic-release/index.js:218:3)
[2024-09-02T19:18:08.813Z]     at async Module.default (file:///usr/local/lib/node_modules/semantic-release/index.js:278:22)
[2024-09-02T19:18:08.814Z]     at async default (file:///usr/local/lib/node_modules/semantic-release/cli.js:55:5) {
[2024-09-02T19:18:08.814Z]   path: [
[2024-09-02T19:18:08.814Z]     'query getAssociatedPRs',
[2024-09-02T19:18:08.814Z]     'repository',
[2024-09-02T19:18:08.814Z]     'commit7c472f',
[2024-09-02T19:18:08.814Z]     '... on Commit',
[2024-09-02T19:18:08.814Z]     'associatedPullRequests',
[2024-09-02T19:18:08.814Z]     'nodes',
[2024-09-02T19:18:08.814Z]     'canBeRebased'
[2024-09-02T19:18:08.814Z]   ],
[2024-09-02T19:18:08.814Z]   extensions: {
[2024-09-02T19:18:08.814Z]     code: 'undefinedField',
[2024-09-02T19:18:08.814Z]     typeName: 'PullRequest',
[2024-09-02T19:18:08.814Z]     fieldName: 'canBeRebased'
[2024-09-02T19:18:08.814Z]   },
[2024-09-02T19:18:08.814Z]   locations: [ { line: 61, column: 19 } ],
[2024-09-02T19:18:08.814Z]   pluginName: '@semantic-release/github'
[2024-09-02T19:18:08.814Z] }
[2024-09-02T19:18:08.814Z] AggregateError: 
[2024-09-02T19:18:08.814Z]     Error: Field 'canBeRebased' doesn't exist on type 'PullRequest'
[2024-09-02T19:18:08.814Z]         at Array.map (<anonymous>)
[2024-09-02T19:18:08.814Z]         at file:///usr/local/lib/node_modules/semantic-release/lib/plugins/pipeline.js:55:13
[2024-09-02T19:18:08.815Z]         at async pluginsConfigAccumulator.<computed> [as success] (file:///usr/local/lib/node_modules/semantic-release/lib/plugins/index.js:87:11)
[2024-09-02T19:18:08.815Z]         at async run (file:///usr/local/lib/node_modules/semantic-release/index.js:218:3)
[2024-09-02T19:18:08.815Z]         at async Module.default (file:///usr/local/lib/node_modules/semantic-release/index.js:278:22)
[2024-09-02T19:18:08.815Z]         at async default (file:///usr/local/lib/node_modules/semantic-release/cli.js:55:5)
[2024-09-02T19:18:08.815Z]     at file:///usr/local/lib/node_modules/�[4msemantic-release�[24m/lib/plugins/pipeline.js:55:13
[2024-09-02T19:18:08.815Z]     at async pluginsConfigAccumulator.<computed> [as success] (file:///usr/local/lib/node_modules/�[4msemantic-release�[24m/lib/plugins/index.js:87:11)
[2024-09-02T19:18:08.816Z]     at async run (file:///usr/local/lib/node_modules/�[4msemantic-release�[24m/index.js:218:3)
[2024-09-02T19:18:08.816Z]     at async Module.default (file:///usr/local/lib/node_modules/�[4msemantic-release�[24m/index.js:278:22)
[2024-09-02T19:18:08.816Z]     at async default (file:///usr/local/lib/node_modules/�[4msemantic-release�[24m/cli.js:55:5) {
[2024-09-02T19:18:08.816Z]   errors: [
[2024-09-02T19:18:08.816Z]     Error: Field 'canBeRebased' doesn't exist on type 'PullRequest'
[2024-09-02T19:18:08.816Z]         at file:///usr/local/lib/node_modules/�[4msemantic-release�[24m/node_modules/�[4maggregate-error�[24m/index.js:23:26
[2024-09-02T19:18:08.816Z]         at Array.map (<anonymous>)
[2024-09-02T19:18:08.816Z]         at new AggregateError (file:///usr/local/lib/node_modules/�[4msemantic-release�[24m/node_modules/�[4maggregate-error�[24m/index.js:16:19)
[2024-09-02T19:18:08.816Z]         at file:///usr/local/lib/node_modules/�[4msemantic-release�[24m/lib/plugins/pipeline.js:55:13
[2024-09-02T19:18:08.817Z]         at async pluginsConfigAccumulator.<computed> [as success] (file:///usr/local/lib/node_modules/�[4msemantic-release�[24m/lib/plugins/index.js:87:11)
[2024-09-02T19:18:08.817Z]         at async run (file:///usr/local/lib/node_modules/�[4msemantic-release�[24m/index.js:218:3)
[2024-09-02T19:18:08.817Z]         at async Module.default (file:///usr/local/lib/node_modules/�[4msemantic-release�[24m/index.js:278:22)
[2024-09-02T19:18:08.817Z]         at async default (file:///usr/local/lib/node_modules/�[4msemantic-release�[24m/cli.js:55:5) {
[2024-09-02T19:18:08.817Z]       path: �[36m[Array]�[39m,
[2024-09-02T19:18:08.817Z]       extensions: �[36m[Object]�[39m,
[2024-09-02T19:18:08.817Z]       locations: �[36m[Array]�[39m,
[2024-09-02T19:18:08.817Z]       pluginName: �[32m'@semantic-release/github'�[39m
[2024-09-02T19:18:08.818Z]     }
[2024-09-02T19:18:08.818Z]   ]
[2024-09-02T19:18:08.870Z] }
Failed to complete release!

We are on GitHub Enterprise Server 3.9.19

Please assist if any changes needs to be made to fix this. Thank you!

@babblebey
Copy link
Member

Thank you for reporting this... We will look into it.

It appears this has something to do with GitHub Enterprise on Classic PAT Token. Here's a similar case but with another field cli/cli#5779

Cc: @gr2m @jedwards1211

@jedwards1211
Copy link
Contributor

@babblebey I bet their GitHub Enterprise has an older version of the GraphQL schema that lacks this canBeRebased field. I guess we should introspect the server's GraphQL schema and adjust the queries we make according to which fields are present?

@travi
Copy link
Member

travi commented Sep 3, 2024

I bet their GitHub Enterprise has an older version of the GraphQL schema that lacks this canBeRebased field

since we havent run into problems like that for some time, we havent taken a step we probably should have taken a long time ago. we should define a support policy for GHES versions. starting with something along the lines of "EOL versions of GHES are unsupported here too" would probably be ok. we could point to a reference that lets folks determine which versions have reached EOL. we'd have to decide how GHES versions impact what we consider a breaking change too.

i dont think the version above would fall outside the support range, even if we had a policy defined, but it made my mind revisit this thought

edit: actually, according to https://docs.github.com/en/enterprise-server@3.12/admin/all-releases, it looks like 3.9 is considered EOL accoding to GitHub. i know it is no small feat getting GHES upgraded and it is usually managed by another team, but you should really try to convince the team that manages your instance to get it updated @tejasbagal1

@jedwards1211
Copy link
Contributor

jedwards1211 commented Sep 3, 2024

canBeRebased was added to the GraphQL API on June 12, 2018. However, in GHES < 3.14 this field is a preview feature.

Probably not the best idea but we could add this header to our GraphQL requests to enable canBeRebased:

Accept: application/vnd.github.merge-info-preview+json

Otherwise, we would just have to conditionally omit the canBeRebased field from our queries

@jedwards1211
Copy link
Contributor

jedwards1211 commented Sep 3, 2024

@travi GHES 3.11 isn't EOL yet and < 3.14 treats this field as a preview feature, so we'll probably have to fix this issue even if we define a support policy

@travi
Copy link
Member

travi commented Sep 3, 2024

we'll probably have to fix this issue even if we define a support policy

agreed. thanks for confirming

@babblebey
Copy link
Member

babblebey commented Sep 3, 2024

Otherwise, we would just have to conditionally omit the canBeRebased field from our queries

This will not be a good option IMO haha 😃, Feels like plaster and duct-tape... What if another field surfaces?? Plus the fields at the moment are not even rich enough yet, this because we requested those fields in the first place to allow us build an object to replicate the issue/pull_request api response object as close as possible in order to aid filtering for successComment/releaseLabels.

We might need to add more fields in the future.

Probably not the best idea but we could add this header to our GraphQL requests to enable canBeRebased:

Accept: application/vnd.github.merge-info-preview+json

So, I'd say we give this a shot IMO.... simply set the custom media type in the Accept header by passing it in the appropriate option at the call of the octokit.graphql

What'd you say @travi??

@travi
Copy link
Member

travi commented Sep 3, 2024

in general, we'll need to be careful to ensure that any fields that we use are available on all versions of the api that we consider "supported". public github and GHEC are simple because they are just whatever the current version supports. GHES is more complicated, even if we informally consider that to only be the GHES versions that have not been EOLed. i'm comfortable with using preview headers to make the request work as long as it works for that whole list (or it drives us to define the supported list more formally, and handling breaking changes). i think it is probably worth tracking an issue to remove the preview header once the versions that need it move into EOL.

we've been pretty aggressive with supported node versions, but that is because those are generally simple for our users to configure on our own. GHES version is more out of the control of our direct users, so it would be difficult for us to justify aggressively dropping support for non-EOL versions.

@aciokler
Copy link

aciokler commented Sep 3, 2024

For those looking for a quick workaround, you can install the following versions of each packages with the following command:

npm install -g semantic-release@24.1.0 @semantic-release/changelog@6.0.3 @semantic-release/commit-analyzer@13.0.0 @semantic-release/exec@6.0.3 @semantic-release/git@10.0.1 @semantic-release/release-notes-generator@14.0.1 @semantic-release/github@10.1.7

@babblebey
Copy link
Member

babblebey commented Sep 3, 2024

in general, we'll need to be careful to ensure that any fields that we use are available on all versions of the api that we consider "supported".

Sure, how about we just remove the specific field canBeRebased for now, It was only introduced to help filtering successComments/releaseLabels, but honestly who's consuming it at the moment!? 🤔

we'll probably have to fix this issue even if we define a support policy

This way we will be fixing this issue as @jedwards1211 as said

Copy link

github-actions bot commented Sep 4, 2024

🎉 This issue has been resolved in version 10.3.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
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants