Skip to content

Getting an "Invalid request payload" error with addNewIssue and an Atlassian Document Format payload #361

@adamk72

Description

@adamk72

Hey, there!

I'm working on syncing GitHub issues over to Jira using GH actions. At a basic level, I have this working just fine; authentication and such aren't the problem.

What I'd like to do is to format the descriptions I'm passing to Jira with bold, headers, etc. Passing raw Markdown syntax doesn't behave as expected (such as ## Title for a header), so I've been trying to pass in an Atlassian Document Format payload.

The error I'm getting is:

✖  fatal  {"errorMessages":["Invalid request payload. Refer to the REST API documentation and try again."]}

My payload looks like this (this is the log result right after the object has been JSON.stringify()'d):

{"fields":{"project":{"key":"SYNTST"},"summary":"Jira Sync #43","description":{"content":[{"type":"paragraph","content":[{"type":"text","text":"Test"}]},{"type":"rule"},{"type":"heading","attrs":{"level":6},"content":[{"type":"text","text":"Test footer"}]}],"type":"doc","version":1},"issuetype":{"name":"Task"}}}

When I pass that payload to the Postman app (with a POST command to '{{jiraUrl}}/rest/api/3/issue/') this works fine. My Jira instance updates with no trouble and with the expected formatting.

This is what the client setup looks like:

const jira = new JiraApi({
   protocol: 'https',
   host: core.getInput('jiraHost', { required: true }),
   username: core.getInput('jiraUsername', { required: true }),
   password: core.getInput('jiraPassword', { required: true }),
   apiVersion: '3',
   strictSSL: true
});

At first I had the wrong apiVersion (using 2 instead of 3) in the code, but I corrected that as well, and am not seeing a way to get deeper into the error (I'm assuming it's from Atlassian, but since I don't see it when using Postman, I can't see what I might be doing wrong). I see that the underlying code is using postman-request so I'd think there isn't a major difference in implementations. Looking for a suggestion to see if there's a way to further debug this, or if you know why this might be happening.

Thanks for your time in advance. I'm going to keep trying things to see what arises.

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