Thanks to visit codestin.com
Credit goes to github.com

Skip to content

When collection settings specify a non-existent hook, documents endpoint silently fails #559

@ohmoses

Description

@ohmoses

When a hook is specified in collection settings and there is no code for such a hook provided in the hooks directory, the collection's endpoint returns an empty response body.

This line is a good starting point for a solution.

Steps to replicate

Using the sample API config in the repo ⇒ collection reference has

    "hooks": {
      "afterGet": ["check-reference"]
    }

Accessing /vjoin/testdb/reference?compose=true&fields={}&filter={}&sort={"name":1} (e.g. clicking on "reference" in the header in Publish) gives an empty response body, crashing Publish.

Expected behavior

Ideally, the API should throw an error on start. Less ideally, probably return a meaningful error object in the response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions