Skip to content
On this page

Logs

Netzo gathers logs from events that happen during the lifetime of a JavaScript isolate project (the project runtime). Logs are useful for debugging your project.

You can view logs by navigating to the Logs tab, or opening the Logs drawer from the Project page. You can filter logs by project, deployment, and event type. You can also search for logs by text (case-insensitive).

Log Types

Logs are structured as follows:

ts
interface Log {
  _type: 'log'
  workspaceId: string
  ref: {
    _id: string
    _type: 'project'
  }
  deployment_id?: string
  project_id?: string
  context?: string
  timestamp?: string
  event_type: Event
  event: object
  execution_id?: string
  isolate_id?: string
}

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
  /** If the event was caused by a running isolate, this field contains the
   * opaque ID of the given isolate. */
  isolate_id?: string
  /** The region where the event was generated. Refer to https://deno.com/deploy/docs/regions
   * for possible values. */
  region: string
}

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.

ts
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.

ts
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.

ts
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'
}

An example log event:

json
{
  "deployment_id": "deployment_id",
  "timestamp": "2021-03-01T00:00:00.000Z",
  "event_type": "log",
  "event": {
    "message": "Hello, world!"
  },
  "isolate_id": "isolate_id",
  "region": "us"
}

uncaughtException

This event is created when an uncaught exception occurs in the isolate.

ts
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.

ts
interface MemoryLimitEventPayload {}

timeLimit

This event is created when the isolate's CPU execution time exceeds the configured time limit.

ts
interface TimeLimitEventPayload {}

Debugging Errors

When an error occurs in your project, the first thing to do is to check the logs. If you see an error in the logs, you can open in to check the event_type and inspect the event itself more information.

To debug common errors, you must first its identify the error type, which in most cases is enough to find the cause of the error. For example, if you see a bootFailure event, you can check the event field to see the error message.

json
{
  "deployment_id": "deployment_id",
  "timestamp": "2021-03-01T00:00:00.000Z",
  "event_type": "bootFailure",
  "event": {
    "message": "Uncaught Error: Cannot find module \"https://example.com/mod.ts\""
  },
  "isolate_id": "isolate_id",
  "region": "us"
}

In this case, the error is caused by a missing module. You can fix this by adding the module to your project.

Error Types

There are a few common errors that you may encounter:

Syntax Errors

Syntax errors are the most common type of error. They are caused by a mistake in your code. For example, if you forget to close a bracket, or if you misspell a keyword, you will get a syntax error.

Syntax Errors will lead to a bootFailure log

Invoking the project will not work since it failed to boot successfully. You will need to fix the syntax error and re-deploy.

Runtime Errors

Runtime errors are caused by a mistake in your code that is not caught by the compiler. For example, if you try to access a property that does not exist, you will get a runtime error.

Runtime Errors might lead to a uncaughtException log

Invoking the project should be possible since it was booted successfully, but the error might be thrown at runtime.

Type Errors

Type errors are caused by a mistake in your code that is not caught by the compiler. For example, if you try to access a property that does not exist, you will get a type error.

Runtime Errors might lead to a uncaughtException log

Invoking the project should be possible since it was booted successfully, but the error might be thrown at runtime.

Logs has loaded