This isn't high priority. I went through all of my created issues and started closing them (if the issue is resolved) or started creating merge requests (if I thought I can contribute to a fix).
Hey @gitlab.mschoenlaub I've tested that.
Using
{
"created_at": "{{object_attributes.created_at}}",
"updated_at": "{{object_attributes.updated_at}}"
}
Testing it via the UI we get:
Hook execution failed: Error while parsing rendered custom webhook template: expected comma (after created_at) at line 2, column 23 [parse.c:762] in '{ "created_at": ""2026-03-16T12:58:34.400Z"", "updated_at": ""2026-03-16T17:00:22.858Z"" }
When commenting on an issue for the webhook to trigger we get:
{
"created_at": "2026-03-17 10:31:37 UTC",
"updated_at": "2026-03-17 10:31:37 UTC"
}
as the payload.
GitLab Ultimate customer reported this issue. Zendesk (internal only)
Adding severity2 as a precaution.
@gitlab.mschoenlaub I am at a loss on how to fix the tests, I wanted to add the following:
describe '#render_custom_template' do
let(:service) { described_class.new(hook, data, :issues_events) }
let(:hook) { create(:project_hook) }
let(:data) { { 'object_attributes' => { 'created_at' => '2026-03-16T17:57:17.223Z', 'title' => 'Test' } } }
context 'with date string values' do
it 'preserves quotes around date strings' do
template = '{"created_at": {{object_attributes.created_at}}}'
result = service.send(:render_custom_template, template, data.deep_stringify_keys)
expect(result).to eq('{"created_at": "2026-03-16T17:57:17.223Z"}')
end
end
context 'with string values' do
it 'preserves quotes around string values' do
template = '{"title": {{object_attributes.title}}}'
result = service.send(:render_custom_template, template, data.deep_stringify_keys)
expect(result).to eq('{"title": "Test"}')
end
end
context 'with numeric values' do
let(:data) { { 'object_attributes': { 'id': 42 } } }
it 'renders numeric values without quotes' do
template = '{"id": {{object_attributes.id}}}'
result = service.send(:render_custom_template, template, data.deep_stringify_keys)
expect(result).to eq('{"id": 42}')
end
end
context 'with boolean values' do
let(:data) { { 'object_attributes': { 'active': true } } }
it 'renders boolean values without quotes' do
template = '{"active": {{object_attributes.active}}}'
result = service.send(:render_custom_template, template, data.deep_stringify_keys)
expect(result).to eq('{"active": true}')
end
end
end
but I see that the change I made broke some tests. Not sure how to proceed?
Hey @gitlab.mschoenlaub
@GitLabDuo re-evaluate the merge request again using best practices and standards as well as ensuring the custom instructions are met. No emojis. Shorter answers.
@GitLabDuo with the change applied, using:
{
"created_at": {{object_attributes.created_at}},
"updated_at": {{object_attributes.updated_at}},
"title": {{object_attributes.title}}
}
Template, testing the webhook manually produces the expected payload:
{
"created_at": "2026-03-15T08:39:33.244Z",
"updated_at": "2026-03-16T18:00:15.147Z",
"title": "Deserunt repudiandae officiis qui praesentium ipsum placeat doloribus unde."
}
The webhook is setup to listen for issue events. When commenting on an issue to trigger that issue event the payload is:
{
"created_at": "2026-03-17 06:10:18 UTC",
"updated_at": "2026-03-17 06:10:18 UTC",
"title": null
}
I believe there's a difference when testing the webhook and actually triggering it normally. Double-check the code and suggest changes if required.
Filip Aleksic (bc214dc0) at 17 Mar 06:17
always convert to json
Adding the change manually so it would actually see the change...
@GitLabDuo The change was applied locally and tested. It does not work as expected. The above-mentioned output is the output when the function is defined as:
def render_custom_template(template, params)
template.gsub(CUSTOM_TEMPLATE_INTERPOLATION_REGEX) do
value = params.dig(*Regexp.last_match(1).split('.'))
value.to_json
end
end
@GitLabDuo with the change applied, using:
{
"created_at": {{object_attributes.created_at}},
"updated_at": {{object_attributes.updated_at}},
"title": {{object_attributes.title}}
}
Template, testing the webhook manually produces the expected payload:
{
"created_at": "2026-03-15T08:39:33.244Z",
"updated_at": "2026-03-16T18:00:15.147Z",
"title": "Deserunt repudiandae officiis qui praesentium ipsum placeat doloribus unde."
}
The webhook is setup to listen for issue events. When commenting on an issue to trigger that issue event the payload is:
{
"created_at": "2026-03-17 06:10:18 UTC",
"updated_at": "2026-03-17 06:10:18 UTC",
"title": null
}
I believe there's a difference when testing the webhook and actually triggering it normally. Double-check the code and suggest changes if required.
@GitLabDuo the change I suggested has multiple lines, in your suggestion only one line needs to be removed. Evaluate the change again. Provide a diff, not a suggestion of the changes.
@GitLabDuo provide the whole diff for the change you have suggested. Use standard diff format.
@GitLabDuo sure. Test with all json-allowed properties (int, string, array, dates as strings, etc)
@GitLabDuo strings can contain spaces as well. Dates can have spaces as well, e.g. 2026-03-16 18:00:15 UTC.