Skip to content

Starting the app-chain client in a UI build / not during dev results into dependency errors with transaction/block hooks #39

@maht0rz

Description

@maht0rz

Reported here:
https://discord.com/channels/484437221055922177/1319673057849380995/1319673057849380995

Full report:
Hi, I am having this 2 errors when trying to .start() the client inside the Next.js (client-side).

Can't inject hook under the underlying hook token: Alias not found in mapping
Uncaught (in promise) Error: Cannot inject the dependency "n" at position #2 of "eX" constructor. Reason:
    Attempted to resolve unregistered dependency token: "ProvableTransactionHook"

or:

    Attempted to resolve unregistered dependency token: "ProvableBlockHook"

The strange thing is that this second error only happens after build and start, not in development.

I was able to fix the second error by doing:

import { container } from "tsyringe";
import { ProvableBlockHook, ProvableBlockHook } from "@proto-kit/protocol";

container.registerInstance("ProvableBlockHook", ProvableBlockHook);
container.registerInstance("ProvableBlockHook", ProvableBlockHook);

However I don't think it should be permanent. So please let me know if there is any way to fix or debug.

Note I am using React 18 but Next.js 15.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions