Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] <webhook notice error> #1503

Closed
1 task done
tomsun28 opened this issue Jan 20, 2024 · 1 comment · Fixed by #1504
Closed
1 task done

[BUG] <webhook notice error> #1503

tomsun28 opened this issue Jan 20, 2024 · 1 comment · Fixed by #1504
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@tomsun28
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

webhook notice error happen


2024-01-20 15:11:05 [alerter-worker-1] WARN  org.dromara.hertzbeat.manager.component.alerter.DispatcherAlarm - DispatchTask sendNoticeMsg error, message: [Discord Bot Notify Error] I/O error on POST request for "https://discord.com/api/v9/channels/www/messages": Connection reset; nested exception is java.net.SocketException: Connection reset
2024-01-20 15:11:05 [alerter-worker-1] ERROR freemarker.runtime - Error executing FreeMarker template
freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> alarmId  [in template "freeMakerTemplate" at line 2, column 16]

----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: ${alarmId}  [in template "freeMakerTemplate" at line 2, column 14]
----
	at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
	at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:481)
	at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:401)
	at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:370)
	at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:100)
	at freemarker.core.DollarVariable.accept(DollarVariable.java:63)
	at freemarker.core.Environment.visit(Environment.java:347)
	at freemarker.core.Environment.visit(Environment.java:353)
	at freemarker.core.Environment.process(Environment.java:326)
	at freemarker.template.Template.process(Template.java:383)
	at org.springframework.ui.freemarker.FreeMarkerTemplateUtils.processTemplateIntoString(FreeMarkerTemplateUtils.java:50)
	at org.dromara.hertzbeat.manager.component.alerter.impl.AbstractAlertNotifyHandlerImpl.renderContent(AbstractAlertNotifyHandlerImpl.java:121)
	at org.dromara.hertzbeat.manager.component.alerter.impl.WebHookAlertNotifyHandlerImpl.send(WebHookAlertNotifyHandlerImpl.java:51)
	at org.dromara.hertzbeat.manager.component.alerter.DispatcherAlarm.sendNoticeMsg(DispatcherAlarm.java:90)
	at org.dromara.hertzbeat.manager.component.alerter.DispatcherAlarm$DispatchTask.sendNotify(DispatcherAlarm.java:137)
	at org.dromara.hertzbeat.manager.component.alerter.DispatcherAlarm$DispatchTask.run(DispatcherAlarm.java:119)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
2024-01-20 15:11:05 [alerter-worker-1] WARN  org.dromara.hertzbeat.manager.component.alerter.DispatcherAlarm - DispatchTask sendNoticeMsg error, message: [WebHook Notify Error] The following has evaluated to null or missing:
==> alarmId  [in template "freeMakerTemplate" at line 2, column 16]

----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: ${alarmId}  [in template "freeMakerTemplate" at line 2, column 14]
----

Expected Behavior

No response

Steps To Reproduce

No response

Environment

HertzBeat version(s): 1.4.4

Debug logs

2024-01-20 15:11:05 [alerter-worker-1] WARN  org.dromara.hertzbeat.manager.component.alerter.DispatcherAlarm - DispatchTask sendNoticeMsg error, message: [Discord Bot Notify Error] I/O error on POST request for "https://discord.com/api/v9/channels/www/messages": Connection reset; nested exception is java.net.SocketException: Connection reset
2024-01-20 15:11:05 [alerter-worker-1] ERROR freemarker.runtime - Error executing FreeMarker template
freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> alarmId  [in template "freeMakerTemplate" at line 2, column 16]

----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: ${alarmId}  [in template "freeMakerTemplate" at line 2, column 14]
----
	at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
	at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:481)
	at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:401)
	at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:370)
	at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:100)
	at freemarker.core.DollarVariable.accept(DollarVariable.java:63)
	at freemarker.core.Environment.visit(Environment.java:347)
	at freemarker.core.Environment.visit(Environment.java:353)
	at freemarker.core.Environment.process(Environment.java:326)
	at freemarker.template.Template.process(Template.java:383)
	at org.springframework.ui.freemarker.FreeMarkerTemplateUtils.processTemplateIntoString(FreeMarkerTemplateUtils.java:50)
	at org.dromara.hertzbeat.manager.component.alerter.impl.AbstractAlertNotifyHandlerImpl.renderContent(AbstractAlertNotifyHandlerImpl.java:121)
	at org.dromara.hertzbeat.manager.component.alerter.impl.WebHookAlertNotifyHandlerImpl.send(WebHookAlertNotifyHandlerImpl.java:51)
	at org.dromara.hertzbeat.manager.component.alerter.DispatcherAlarm.sendNoticeMsg(DispatcherAlarm.java:90)
	at org.dromara.hertzbeat.manager.component.alerter.DispatcherAlarm$DispatchTask.sendNotify(DispatcherAlarm.java:137)
	at org.dromara.hertzbeat.manager.component.alerter.DispatcherAlarm$DispatchTask.run(DispatcherAlarm.java:119)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
2024-01-20 15:11:05 [alerter-worker-1] WARN  org.dromara.hertzbeat.manager.component.alerter.DispatcherAlarm - DispatchTask sendNoticeMsg error, message: [WebHook Notify Error] The following has evaluated to null or missing:
==> alarmId  [in template "freeMakerTemplate" at line 2, column 16]

----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: ${alarmId}  [in template "freeMakerTemplate" at line 2, column 14]
----

Anything else?

No response

@tomsun28 tomsun28 added bug Something isn't working good first issue Good for newcomers labels Jan 20, 2024
@Carpe-Wang
Copy link
Contributor

Carpe-Wang commented Jan 20, 2024

I noticed that org/dromara/hertzbeat/manager/component/alerter/impl/AbstractAlertNotifyHandlerImpl.renderContent method has code model.put("alarmId", alert.getId()); . Is the alarmId allowed to be null? Do we have default value about alarmId if alarmId is null and we don’t allow alarmId is null?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants