NOTE: these docs are deprecated. Please see our new Subhosting docs site here instead.
Events
Deno Deploy internally gathers events for various things that happen during the lifetime of a JavaScript isolate. These events are collected and reported to your origin server via the POST /events RPC endpoint.
Structure
Events are structured in the following form:
interface Event {
/** The ID of the deployment that caused this event to be generated. */
deployment_id: string;
/** Timestamp for when this event was created, in RFC3339 format. */
timestamp: string;
/** The type of event. The full list of events is described below. */
event_type:
| "boot"
| "bootFailure"
| "log"
| "uncaughtException"
| "memoryLimit"
| "timeLimit";
/** The payload of the event. The full list of possible structures is
* described below. */
event:
| BootEventPayload
| BootFailureEventPayload
| LogEventPayload
| UncaughtExceptionEventPayload
| MemoryLimitEventPayload
| TimeLimitEventPayload;
/** The opaque ID of the given isolate. */
execution_id: string;
/** The region where the event was generated. Refer to https://deno.com/deploy/docs/regions
* for possible values. */
region: string;
/** The additional information associated with this event may appear here. */
context?: JSONValue;
}
Example of a log event:
{
"deployment_id": "my-deployment",
"timestamp": "2022-01-01T00:00:00Z",
"event_type": "log",
"event": {
"msg": "Hello, world!",
"level": "info"
},
"execution_id": "d3ec60fc-e58e-4298-bb96-71f0bc4a9abe",
"region": "asia-east1"
}
Event types
boot
This event is created when an isolate successfully boots. Not every request results in a boot event, because isolates can be re-used for multiple requests.
interface BootEventPayload {
/** The time it took to boot the isolate, in seconds. */
boot_time: number;
}
bootFailure
This event is created when an isolate fails to boot.
interface BootFailureEventPayload {
/** A human readable message containing information about why the isolate
* failed to boot. */
msg: string;
}
log
This event is created when a log message is written from the isolate using the
console
API.
The log severity level is included in the event payload and is determined by which log function is used to write the message.
Console API function | Severity level |
---|---|
console.log() |
info |
console.debug() |
debug |
console.info() |
info |
console.dir() |
info |
console.dirxml() |
info |
console.warn() |
warning |
console.error() |
error |
console.assert() |
error |
console.count() |
info |
console.countReset() |
info ¹ |
console.table() |
info |
console.time() |
info ¹ |
console.timeLog() |
info ¹ |
console.timeEnd() |
info ¹ |
console.group() |
info |
console.groupCollapsed() |
info |
console.groupEnd() |
info |
console.clear() |
N/A |
console.trace() |
error |
¹: The warning
level may be emitted if invalid arguments are provided to the
function.
interface LogEventPayload {
/** The message that was logged. The message may contain ANSI escape codes to
* colorize the message. */
msg: string;
level: "debug" | "info" | "warning" | "error";
}
uncaughtException
This event is created when an uncaught exception occurs in the isolate.
interface UncaughtExceptionEventPayload {
/** The message of the exception. */
exception: string;
}
memoryLimit
This event is created when the isolate’s memory usage exceeds the configured memory limit.
interface MemoryLimitEventPayload {
}
timeLimit
This event is created when the isolate’s CPU execution time exceeds the configured time limit.
interface TimeLimitEventPayload {
/** An opaque ID which uniquely identifies the time-limit event. */
id: string;
}