Error "301 - undefined" when updating issue via JIRA REST API in Jira Cloud

Hello,

One of the clients for our Jira Atlassian Express Connect add-on is facing the following issue: all operations involving reading Jira data work correctly, however all push operations have the following message in response: “301 - undefined” and the statusCode is 301. Reading/updating Jira issues are performed using basic auth, with user email and API token:

return request({
    uri,
    headers: {
        'Content-Type': 'application/json',
        'x-atlassian-force-account-id': true
    },
    auth: {
        user: <email>,
        pass: <API token>
    },
    resolveWithFullResponse: true
})

Jira instance for this client is Jira Cloud (nor server).

Would error “301 - undefined” be returned if API token used in the request is for user who does not have permissions to push data into Jira (create issue, etc)?

Thank you.
Irena Shemesh

Hi @irena.shemesh,

Welcome to the community!

Which endpoint are you trying to POST/PUT to? Status response depends on which API you’re trying to call. For more details, please see our API documentation: https://developer.atlassian.com/cloud/jira/platform/rest/v3/

Cheers,
Anne

Hello Anne,

Thank you for looking into it. There are several commands that fail for this user with “301 - undefined”. Here they are:

  1. List item
{"uri":"http://......atlassian.net/rest/api/2/issue/<num>","method":"PUT", "headers":{"Content-Type":"application/json","x-atlassian-force-account-id":true},"body":{"update":{"assignee":[{"operation":"set","value":{"id":"<accountId>"}}]}},"json":true}

This returned:

 "status":"error","error":{"name":"StatusCodeError","statusCode":301,"message":"301 - undefined"
  1. List item
{"uri":"http://......atlassian.net/rest/api/2/issue/<num>/comment","method":"POST","headers":{"Content-Type":"application/json","x-atlassian-force-account-id":true},"body":{"body":"Test comment"},"json":true ...}

Same error returned

  1. List item
{"uri":"http://.....atlassian.net/rest/api/2/issue","method":"POST","headers":{"Content-Type":"application/json","x-atlassian-force-account-id":true},"body":{"fields":{"summary":"TEST STORY","project":{"key":"KEY"},"issuetype":{"id":"10001"}},"update":{}} ...}

Same error

From what we saw, this user can correctly get data from Jira, but cannot push/update data.

Thank you,
Irena Shemesh