Project

General

Profile

task #45

HTTP error 406 during recurrence creation (text/html format requested)

Added by issrec 5 months ago. Updated 5 months ago.

Status:
in progress
Priority:
bug
Assignee:
Target version:
Redmine version:
4.2.x

Description

After adding a recurring issue, the page with the URI Pattern /issues/:issue_id/recurrences is loaded, which ends with a 406 error (presented by the browser's default page).
The following entry can be found in the Redmine logs:

...
I, [2023-11-24T19:52:56.765771 #1]  INFO -- : Started POST "/issues/4549/recurrences" for 192.168.235.13 at 2023-11-24 19:52:56 +0000
I, [2023-11-24T19:52:56.766672 #1]  INFO -- : Processing by IssueRecurrencesController#create as HTML
I, [2023-11-24T19:52:56.766728 #1]  INFO -- :   Parameters: {"utf8"=>"", "recurrence"=>{"creation_mode"=>"copy_first", "include_subtasks"=>"false", "multiplier"=>"1", "mode"=>"monthly_day_from_first", "anchor_to_start"=>"true", "anchor_mode"=>"first_issue_fixed", "delay_multiplier"=>"0", "delay_mode"=>"day", "count_limit"=>"2"}, "limit_mode"=>"count", "commit"=>"Add", "authenticity_token"=>"4Vkq5XOfiewXsPDqb7mKO+YQZTdhSLSk/unuuYmbFofKo+RxDpfHNcA2jGvKUC3qTjlw9cKo8EZd7KjW0CXJ0g==", "issue_id"=>"4549"}
I, [2023-11-24T19:52:56.771993 #1]  INFO -- :   Current user: test (id=64)
I, [2023-11-24T19:52:56.815807 #1]  INFO -- : Completed 406 Not Acceptable in 49ms (ActiveRecord: 10.6ms)
F, [2023-11-24T19:52:56.816894 #1] FATAL -- :
F, [2023-11-24T19:52:56.817124 #1] FATAL -- : ActionController::UnknownFormat (IssueRecurrencesController#create is missing a template for this request format and variant.
request.formats: ["text/html"]
request.variant: []):
F, [2023-11-24T19:52:56.817359 #1] FATAL -- :
F, [2023-11-24T19:52:56.817499 #1] FATAL -- : lib/redmine/sudo_mode.rb:61:in `sudo_mode'
...

The plugin creates three routes:


The table of existing issue recurrences is implemented using the create action. The same functionality for project is implemented using the index action. According to the logged error message, the plugin is missing an html template for the create action. Looking at the files in plugins/issue_recurring/app/views/issue_recurrences/, you can see that there is an index.html.erb file/template, but no create.html.erb file/template.


The workaround for this error is to create a symbolic link using the command:

ln -f -s -T index.html.erb create.html.erb


Token votes

History

#1 Updated by cryptogopher 5 months ago

  • Subject changed from HTTP ERROR 406 to HTTP error 406 during recurrence creation (text/html format requested)
  • Status changed from new to in progress

Recurrence creation is done using JavaScript. The recurrence is created and list of recurrences refreshed on issue page without page reload. During this action create.js.erb is used as a view template.

For some reason your browser is requesting text/html format - for which there is no template available. Is it possible that you have JavaScript turned off?

#2 Updated by issrec 5 months ago

27

I have JavaScript enabled. I use Firefox browser, OS: GNU/Linux.
This is what the browser request looks like when a 406 error occurs: 2023-11-25_23.50.49_Screenshot.png

PS. Additionally, after completing the creation of the recurrence, in the Issue recurrences tab, when we reload it (refresh - F5), the issue recurrence will be created again (previously a browser message about resending the data needed to perform the action). Re-creating the issue recurrence also happens on the 406 error page - as seen in this video.

#3 Updated by cryptogopher 5 months ago

28
29

That the recurrence is created despite the 406 error is the correct behavior. Application:
1. Succesufully tries to create recurrence, then
2. Fails only when trying to prepare view of all available recurrences in requested format.

Resending the same form causes second recurrence to be added, as expected.

For some reason your browser requests text/html format for (see Accept: text/html... in Request Headers in your screenshot), where it should request text/javascript (see my 1st screenshot).

a) Can you locate and show me the form element corresponding to the new recurrence form, as shown on my 2nd screenshot?
b) Do you have any browser plugins/extensions that could change the request details?

#4 Updated by issrec 5 months ago

30

cryptogopher wrote:

That the recurrence is created despite the 406 error is the correct behavior. Application:
1. Succesufully tries to create recurrence, then
2. Fails only when trying to prepare view of all available recurrences in requested format.

Resending the same form causes second recurrence to be added, as expected.

OK
 

For some reason your browser requests text/html format for (see Accept: text/html... in Request Headers in your screenshot), where it should request text/javascript (see my 1st screenshot).

And this is the starting point for further exploration...
In my case the initializer is document, and in yours it is jquery-... - hmmm, interesting?
 

a) Can you locate and show me the form element corresponding to the new recurrence form, as shown on my 2nd screenshot?

As you wish - 2023-11-26_09.04.55_Screenshot.png
 

b) Do you have any browser plugins/extensions that could change the request details?

I use:

I turned them all off and tested again - no changes, the Accept: text/html... in the request headers is still sent.
I also have Chromium and LibreWolf browsers - it works the same here, the Accept: text/html... is sent in the request headers too.
So this must be my


After testing..., the culprit turned out to be a plugin Redmine Dynamic edit Issue plugin.
Thank you for your support and advice.

PS. The create.html.erb file is not needed.

#5 Updated by cryptogopher 5 months ago

So it looks like redmine_issue_dynamic_edit plugin somehow modifies the AJAX requests outside the ones it is handling by itself.

I think it would be reasonable to report this issue's details to the author of the other plugin. If you decide to do so, please share the ticket number with us, so I can track it.

#6 Updated by issrec 5 months ago

cryptogopher wrote:

I think it would be reasonable to report this issue's details to the author of the other plugin. If you decide to do so, please share the ticket number with us, so I can track it.

I registered the issue: The plugin modifies the AJAX requests outside the ones it is handling by itself

#7 Updated by issrec 5 months ago

It looks like it's a lot better than it was - comment from Dec 6, 2023, 1:50 PM GMT+1.

Also available in: Atom PDF