An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
Hello
That ENOTFOUND is happening because * can’t be used as a real hostname in an HTTP request. Your OS DNS resolver is literally trying to resolve a host named * (asterisk), which will always fail.
What you must pass to EventGridPublisherClient is the exact Topic Endpoint for your topic, which looks like:
https://<your-topic-name>.<region>-1.eventgrid.azure.net/api/events
…and you should fetch it from Azure, not construct it by hand. Microsoft’s doc shows getting it from the topic resource (Portal or CLI):
https://learn.microsoft.com/en-us/azure/event-grid/post-to-custom-topic
import { EventGridPublisherClient, AzureKeyCredential } from "@azure/eventgrid";
const endpoint = process.env.EVENTGRID_TOPIC_ENDPOINT!;
// Example value (from Azure): https://mytopic.westeurope-1.eventgrid.azure.net/api/events
const client = new EventGridPublisherClient(
endpoint,
"EventGrid",
new AzureKeyCredential(process.env.EVENTGRID_KEY!)
);
await client.send([{ id: "1", eventType: "test", subject: "demo", eventTime: new Date(), data: { hello: "world" }, dataVersion: "1.0" }]);
If you replace * with your real topic name and it still says ENOTFOUND then it’s a genuine DNS/service availability issue for that region/endpoint . In that case the next check is: run nslookup <topic>.<region>-1.eventgrid.azure.net from another network/VM to confirm it’s not local DNS, and consider deploying the topic in a different region as a workaround while you open a Microsoft support ticket.