Hello @TEE WEI KIAT,
welcome to this moderated Azure community forum.
The error message tells is the CloudEvent cannot be converted.
It seems a string is ingested?
Please try to find out what type of parameter contains the incoming message first.
Because you use a EventGridTrigger, my first thoughts are about 'EventGridEvent'.
Check out my blog post on using Azure Digital Twins. It contains a GitHub example based the IoT Hub EventGrid output. There the message is ingested as a 'EventGridEvent'.
For an EventHub, you typically use the EventData class.
But perhaps you just need to stick to 'string' first.
Let us know if this helps.
If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.