mattermost/mattermost-plugin-jira

error: failed to get a connect link: oauth1: Server returned status 400

xueyu888 opened this issue ยท 10 comments

I am using Jira Server connected with Mattermost. I followed the tutorial to configure the Jira plugin, but at the final step of connection, when clicking in, it reports an error:
"failed to get a connect link: oauth1: Server returned status 400"

My Jira version: Jira Software 9.7.0
Mattermost version: 9.5.1

My Mattermost installation environment is on Windows 11's WSL (Windows Subsystem for Linux), and I used Docker to install the server-side. On Windows 11, I am using the client-side application. Jira is installed on another Linux server in the same network segment.

image

Hi @xueyu888, thanks for filing this issue.

I have a questions so I can understand better:

  • Are you using the Mattermost desktop app? If so, can you try running Mattermost in your browser?
  • Can you check your server logs to see if there are any additional logs related to this error? You may need to configure the log level to DEBUG in the MM system console.

@mickmister Thank you for your response.

  • I've tried running Mattermost in the browser, and the same problem occurs.

  • The debug logs in Mattermost show as follows:

{"timestamp":"2024-03-12 10:19:24.912 Z","level":"warn","msg":"ERROR: ","caller":"app/plugin_api.go:1006","plugin_id":"jira","Status":"500","Error":"failed to get a connect link: oauth1: Server returned status 400","Path":"/instance/aHR0cDovLzE5Mi4xNjguMTEuMTE6ODA4/user/connect","Method":"GET","query":""}
{"timestamp":"2024-03-12 10:19:24.912 Z","level":"debug","msg":"unexpected plugin response","caller":"app/plugin_api.go:997","plugin_id":"jira","Status":"500","Path":"/instance/aHR0cDovLzE5Mi4xNjguMTEuMTE6ODA4/user/connect","Method":"GET","query":""}

  • The logs from the Jira server are as follows:

07-Mar-2024 15:17:59.482 INFO [http-nio-8080-exec-2] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header
Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name [0xff0xf40xff0xfd0x06...]. HTTP method names must be tokens
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:419)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:271)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
created com.atlassian.jira.plugins.webhooks.ao.WebhookDaoImpl@4e953c75 1318403189 with events jira:issue_updated
comment_created
jira:issue_created
comment_updated
jira:issue_deleted
jira:worklog_updated
comment_deleted
AO_4AEACD_WEBHOOK_DAO {ID = 1} 406
created com.atlassian.jira.plugins.webhooks.ao.WebhookDaoImpl@10c2a38f 281191311 with events jira:issue_updated
comment_created
jira:issue_created
comment_updated
jira:issue_deleted
jira:worklog_updated
comment_deleted
AO_4AEACD_WEBHOOK_DAO {ID = 1} 406
created com.atlassian.jira.plugins.webhooks.ao.WebhookDaoImpl@73d09567 1943049575 with events null
AO_4AEACD_WEBHOOK_DAO {ID = 2} 407
set eventscom.atlassian.jira.plugins.webhooks.ao.WebhookDaoImpl@73d09567 1943049575
AO_4AEACD_WEBHOOK_DAO {ID = 2} 407
jira:issue_updated
comment_created
jira:issue_created
comment_updated
jira:issue_deleted
jira:worklog_updated
comment_deleted
created com.atlassian.jira.plugins.webhooks.ao.WebhookDaoImpl@43c07fde 1136689118 with events jira:issue_updated
comment_created
jira:issue_created
comment_updated
jira:issue_deleted
jira:worklog_updated
comment_deleted
AO_4AEACD_WEBHOOK_DAO {ID = 2} 407

@raghavaggarwal2308 Can you or another team member see if this is reproducible with the version numbers specified in the issue description? @xueyu888 I assume you're using the latest version of the Jira plugin v4.1.0?

@xueyu888 Was this working before on your server? If so, have there been any upgrades of the Jira Server since then? Is there anything with your setup that comes to mind that may be related?

The errors you provided from Jira's side seem quite cryptic. I feel there's not much to go off of in terms of our interaction with Jira's API. It seems related to webhooks, so not sure if it's linked to the OAuth issue

@mickmister I tried reproducing the issue with:
Jira server version: Jira Software 9.7.0
Local Mattermost version: 9.5.1

I was able to connect to my Jira account by following the setup flow successfully. I will look more into it once we get some more details from @xueyu888 .

Hi @raghavaggarwal2308 , Did you use the HTTP protocol when you tried to replicate the issue?

I tried again following the installation tutorial, but I still have the same problem. The version of my Jira plugin is v4.1.0. Both my Mattermost and Jira are running in Docker, and both are using the HTTP protocol. Here are some of my configuration details:

image
image
image
image

If it's not because of the HTTP issue, I will try reinstalling Jira tomorrow and go through the tutorial again to see if that solves the problem.

@xueyu888 Tried with HTTP protocol as well, still working fine for me.

@xueyu888 Tried with HTTP protocol as well, still working fine for me.

Okay, I will come back and provide feedback after attempting to reinstall Jira

I changed the environment for installation, and the problem has been solved. Thanks everyone for your help!