Skip to content

Add error handling to database query in config to prevent startup failure #17

@alikhere

Description

@alikhere

Description:
Currently, running npm run dev locally can throw the following error:

Unexpected error: Cannot destructure property 'Symbol(Symbol.iterator)' of '(intermediate value)' as it is null.

This happens because the config file(observablehq.config.js) tries to destructure the API response without checking for errors(which happen when database was unavailable or environment variables were missing, the API call returned null)

const {
  result: [{ results: clients }],
} = await query(`SELECT DISTINCT payer FROM indexer_proof_set_rails WHERE with_cdn = true ORDER BY payer`)

Scrrenshot

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions