Issues with post-receive hook

For new installation of 8.16.2, post-receive hooks are not working and so mail notifications and activities logs are not showing on dashboard. This is the error we are getting while push to the repo

remote: /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_post_receive.rb:58:in []': no implicit conversion of String into Integer (TypeError) remote: from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_post_receive.rb:58:in print_merge_request_link’
remote: from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_post_receive.rb:54:in block in print_merge_request_links' remote: from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_post_receive.rb:54:in each’
remote: from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_post_receive.rb:54:in print_merge_request_links' remote: from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_post_receive.rb:37:in exec’
remote: from hooks/post-receive:17:in `’

This is the post-receive hook file


Fix the PATH so that gitlab-shell can find git-upload-pack and friends.

ENV[‘PATH’] = ‘/opt/gitlab/bin:/opt/gitlab/embedded/bin:’ + ENV[‘PATH’]

#!/usr/bin/env ruby

This file was placed here by GitLab. It makes sure that your pushed commits

will be processed properly.

refs = $
key_id = ENV.delete(‘GL_ID’)
repo_path = Dir.pwd

require_relative ‘…/lib/gitlab_custom_hook’
require_relative ‘…/lib/gitlab_post_receive’

if, key_id, refs).exec &&, key_id).post_receive(refs)
exit 0
exit 1