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

Action fails with "Error: Request body length does not match content-length header" #76

Open
relaxdiego opened this issue Jul 10, 2024 · 2 comments

Comments

@relaxdiego
Copy link

This action was previously working for us but started failing randomly since about 3 weeks ago. I tried looking at its code but couldn't find anything to suggest what the cause might be. There is this issue in another project that experiences the same error but I didn't take time yet to dig deeper: semantic-release/github#746. Hopefully that provides enough hints.

Sample error:

Run benc-uk/[email protected]
  with:
    repo: XXXXXXXXX/yyyyyyyyyyy
    workflow: zzzzzzzzz.yml
    ref: main
    token: ***
🏃 Workflow Dispatch Action v1.2.1
🔎 Found workflow, id: 58803020, name: XXXXXXXXXX path: .github/workflows/yyyyyyyy.yml
🚀 Calling GitHub API to dispatch workflow...
Error: Request body length does not match content-length header
@benc-uk
Copy link
Owner

benc-uk commented Aug 3, 2024

It seems like an issue with the API?
Could you also try the latest version v1.2.4 ?

@frankvollebregt
Copy link

Hey! I was also experiencing this since a recent version (I think the update that added node 20 support), up to the current version too (1.2.4)

For me, our organization name on GH had changed. What Github then does is it keeps redirecting the old name to the new name, but I guess the API gets confused since the name length changes, and the action fails as a result.

Solution

For me, the solution was to use the new (current) name of the organization/account where the workflow repo is located

Example

Before:

- uses: benc-uk/workflow-dispatch@v1
  with:
    workflow: workflow-name
    repo: longer-company-name/repo-name
    ref: develop
    token: ${{ secrets.PERSONAL_TOKEN }}
    inputs: '{ "foo": "bar" }'

Then, our organization GH account changed from longer-company-name to comp-name (i.e. the length of the organization name changed, I suspect this might be key), and the above error occured. To fix it, I had to use our new company name in the workflow:

- uses: benc-uk/workflow-dispatch@v1
  with:
    workflow: workflow-name
    repo: comp-name/repo-name
    ref: develop
    token: ${{ secrets.PERSONAL_TOKEN }}
    inputs: '{ "foo": "bar" }'

If I just browse to github.com/longer-company-name/repo-name GH automatically redirects me to github.com/comp-name/repo-name, but I guess the action/API does not do this everywhere.

If it's fixable within this action, even better, but you should honestly just keep the organization/account names up-to-date anyways 😅 I suspect this may also be why the issue occurs for other people :)

Also, thanks for the useful action :)

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

No branches or pull requests

3 participants