The plugin sends the event to http sink but the body is empty and following error is thrown in Jenkins
enkins | 2023-05-30 03:23:06.949+0000 [id=245] INFO i.j.p.cloudevents.sinks.HTTPSink#sendCloudEvent: Received response: 404
jenkins | com.fasterxml.jackson.databind.JsonMappingException: Cannot invoke "java.util.Date.getTime()" because "this.createdDate" is null (through reference chain: io.jenkins.plugins.cloudevents.model.JobModel["createdDate"])
jenkins | at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:390)
jenkins | at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:349)
jenkins | at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:316)
jenkins | at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:778)
jenkins | at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:178)
jenkins | at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480)
jenkins | at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319)
jenkins | at com.fasterxml.jackson.databind.ObjectMapper._writeValueAndClose(ObjectMapper.java:4485)
jenkins | at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3740)
jenkins | at io.jenkins.plugins.cloudevents.CloudEventsUtil.convertToJson(CloudEventsUtil.java:16)
jenkins | at io.jenkins.plugins.cloudevents.sinks.HTTPSink.buildCloudEvent(HTTPSink.java:38)
jenkins | at io.jenkins.plugins.cloudevents.sinks.HTTPSink.sendCloudEvent(HTTPSink.java:57)
jenkins | at io.jenkins.plugins.cloudevents.Stage.handleEvent(Stage.java:38)
jenkins | at io.jenkins.plugins.cloudevents.listeners.CEJobListener.onFinalized(CEJobListener.java:30)
jenkins | at hudson.model.listeners.RunListener.lambda$fireFinalized$3(RunListener.java:244)
jenkins | at jenkins.util.Listeners.lambda$notify$0(Listeners.java:59)
jenkins | at jenkins.util.Listeners.notify(Listeners.java:67)
jenkins | at hudson.model.listeners.RunListener.fireFinalized(RunListener.java:242)
jenkins | at hudson.model.Run.onEndBuilding(Run.java:2062)
jenkins | at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:663)
jenkins | at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:1065)
jenkins | at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1587)
jenkins | at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:509)
jenkins | at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:38)
jenkins | at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
jenkins | at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
jenkins | at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
jenkins | at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51)
jenkins | at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
jenkins | at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
jenkins | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
jenkins | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
jenkins | at java.base/java.lang.Thread.run(Thread.java:833)
jenkins | Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Date.getTime()" because "this.createdDate" is null
jenkins | at io.jenkins.plugins.cloudevents.model.JobModel.getCreatedDate(JobModel.java:90)
jenkins | at jdk.internal.reflect.GeneratedMethodAccessor417.invoke(Unknown Source)
jenkins | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
jenkins | at java.base/java.lang.reflect.Method.invoke(Method.java:568)
jenkins | at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:689)
jenkins | at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
jenkins | ... 29 more
Jenkins and plugins versions report
The plugin sends the event to http sink but the body is empty and following error is thrown in Jenkins
Environment
```text Jenkins: 2.387.3 OS: Linux - 5.4.0-1103-azure Java: 17.0.7 - Eclipse Adoptium (OpenJDK 64-Bit Server VM) ``` Plugin: ```text cloudevents:1.0.0 ```What Operating System are you using (both controller, and any agents involved in the problem)?
NA
Reproduction steps
Job Started
,Job Completed
,Job Finalized
Expected Results
HttpSink to receive request with body object similar to below, as mentioned in https://github.com/jenkinsci/cloudevents-plugin#build-events
Actual Results
HttpSink to receive request
without
body objectAnything else?
No response