Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hook call doesn't work #1935

Open
URVL opened this issue Nov 2, 2023 · 0 comments
Open

hook call doesn't work #1935

URVL opened this issue Nov 2, 2023 · 0 comments
Labels

Comments

@URVL
Copy link

URVL commented Nov 2, 2023

Impress and Node.js versions

impress - 3.0.11 , node - v20.9.0

Platform

Darwin Kernel Version 22.5.0: Mon Apr 24 20:53:44 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T8103 arm64

Describe the bug

i created a hook file /application/api/invokehook.js
hook code:

({
  router({ method, args, verb, headers }) {
    const ip = context.client.ip;
    console.log({ method, args, ip, verb, headers });
    return {};
  },
});

when querying localhost:8001/api/invokehook I get a json response

{"type": "callback", "id":0, "error":{"message": "Not Found", "code":404}}

To Reproduce

described above

Expected behavior

I expected to be able to call the hook using HTTP requests

Screenshots

Снимок экрана 2023-11-02 в 17 44 51

Additional context

the screenshot shows a variant that started working

I haven't figured out why utit.invokehook.default is needed, so for now this is the variant of fix implementation

here is a link to the original code https://github.com/metarhia/impress/blob/4cabe81e1cef6870a10d7c7b020f8618db3bdbf3/lib/application.js#L182C6-L182C6

@URVL URVL added the bug label Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant