Describe the bug
Hi,
I thought about raising some issues here regarding building and using the extend-admin-console-node:
Building
Maven issues
Maven seems to have trouble running pnpm:
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.15.0:pnpm (pnpm-install) on project my-admin-ui: Failed to run task: 'pnpm install --prefer-offline --frozen-lockfile --ignore-scripts' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Building with Maven thus doesn't really work. It does work running pnpm build by itself (after the issues below are fixed:).
Missing packages
When building, we get this error:
pnpm build
vite-project@0.0.0 build /private/tmp/keycloak-quickstarts/extension/extend-admin-console-node
tsc && vite build
src/App.tsx:8:8 - error TS2307: Cannot find module '@keycloak/keycloak-admin-ui' or its corresponding type declarations.
8 } from "@keycloak/keycloak-admin-ui";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.tsx:3:34 - error TS2307: Cannot find module '@keycloak/keycloak-admin-ui' or its corresponding type declarations.
3 import { KeycloakProvider } from "@keycloak/keycloak-admin-ui";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/routes.tsx:1:32 - error TS2307: Cannot find module '@keycloak/keycloak-admin-ui' or its corresponding type declarations.
1 import { ClientsSection } from "@keycloak/keycloak-admin-ui";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We need to add the package with pnpm add @keycloak/keycloak-admin-ui.
Double client assignment (?)
After adding @keycloak/keycloak-admin-ui, we get this error:
vite-project@0.0.0 build /private/tmp/keycloak-quickstarts/extension/extend-admin-console-node
> tsc && vite build
src/App.tsx:29:22 - error TS2345: Argument of type 'KeycloakAdminClient' is not assignable to parameter of type 'SetStateAction<KeycloakAdminClient | undefined>'.
Type 'import("/private/tmp/keycloak-quickstarts/extension/extend-admin-console-node/node_modules/.pnpm/@keycloak+keycloak-admin-client@26.2.5/node_modules/@keycloak/keycloak-admin-client/lib/client").KeycloakAdminClient' is not assignable to type 'import("/private/tmp/keycloak-quickstarts/extension/extend-admin-console-node/node_modules/.pnpm/@keycloak+keycloak-admin-client@26.0.7/node_modules/@keycloak/keycloak-admin-client/lib/client").KeycloakAdminClient'.
Property '#private' in type 'KeycloakAdminClient' refers to a different member that cannot be accessed from within type 'KeycloakAdminClient'.
29 setAdminClient(client);
This is most likely due the newer version of @Keycloak/keycloak-admin-client:
pnpm why @keycloak/keycloak-admin-client
Legend: production dependency, optional only, dev only
vite-project@0.0.0 /private/tmp/keycloak-quickstarts/extension/extend-admin-console-node (PRIVATE)
dependencies:
@keycloak/keycloak-admin-ui 26.2.5
├── @keycloak/keycloak-admin-client 26.2.5
├─┬ @keycloak/keycloak-ui-shared 26.2.5
│ └── @keycloak/keycloak-admin-client 26.2.5
└─┬ vite-project vite-project@file:(typescript@5.5.4)
└─┬ @keycloak/keycloak-ui-shared 26.2.5
└── @keycloak/keycloak-admin-client 26.2.5
@keycloak/keycloak-ui-shared 26.0.7
└── @keycloak/keycloak-admin-client 26.0.7
devDependencies:
@keycloak/keycloak-admin-client 26.0.7
After removing the package and installing it with pnpm add @keycloak/keycloak-admin-client@26.2.5, it works and I can build.
Runtime problems:
Start-server script needs an update:
This line on start-server.sh should be changed from:
`--features="login2,account3,admin-fine-grained-authz,transient-users,oid4vc-vci"`,
to
`--features="login:v2,account:v3,admin-fine-grained-authz,transient-users,oid4vc-vci"`,
Otherwise the server won't start.
Double react
Once I get the server going, using start-server.sh --admin-dev, and I go to the server url, I get a spinning ball.
On the browser console, I see this:
[Debug] [vite] connecting... (client, line 495)
[Debug] [vite] connected. (client, line 614)
[Error] Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
printWarning (chunk-VKGMVR5V.js:136)
error (chunk-VKGMVR5V.js:120)
resolveDispatcher (chunk-VKGMVR5V.js:1045)
useContext (chunk-VKGMVR5V.js:1051)
fi (chunk-WJY3I722.js:24971)
Ule (chunk-WJY3I722.js:80654)
Module Code (routes.tsx:7)
[Error] TypeError: null is not an object (evaluating 'dispatcher.useContext')
useContext (chunk-VKGMVR5V.js:1062)
fi (chunk-WJY3I722.js:24971)
Ule (chunk-WJY3I722.js:80654)
Module Code (routes.tsx:7)
So it seems to be a problem there.
I have messaged @edewit about these things, and we agreed I should open this issue.
Version
26.2.5
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Anything else?
No response
Describe the bug
Hi,
I thought about raising some issues here regarding building and using the extend-admin-console-node:
Building
Maven issues
Maven seems to have trouble running pnpm:
Building with Maven thus doesn't really work. It does work running
pnpm buildby itself (after the issues below are fixed:).Missing packages
When building, we get this error:
pnpm build
src/App.tsx:8:8 - error TS2307: Cannot find module '@keycloak/keycloak-admin-ui' or its corresponding type declarations.
8 } from "@keycloak/keycloak-admin-ui";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.tsx:3:34 - error TS2307: Cannot find module '@keycloak/keycloak-admin-ui' or its corresponding type declarations.
3 import { KeycloakProvider } from "@keycloak/keycloak-admin-ui";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/routes.tsx:1:32 - error TS2307: Cannot find module '@keycloak/keycloak-admin-ui' or its corresponding type declarations.
1 import { ClientsSection } from "@keycloak/keycloak-admin-ui";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We need to add the package with
pnpm add @keycloak/keycloak-admin-ui.Double client assignment (?)
After adding @keycloak/keycloak-admin-ui, we get this error:
This is most likely due the newer version of @Keycloak/keycloak-admin-client:
After removing the package and installing it with
pnpm add @keycloak/keycloak-admin-client@26.2.5, it works and I can build.Runtime problems:
Start-server script needs an update:
This line on
start-server.shshould be changed from:to
Otherwise the server won't start.
Double react
Once I get the server going, using
start-server.sh --admin-dev, and I go to the server url, I get a spinning ball.On the browser console, I see this:
So it seems to be a problem there.
I have messaged @edewit about these things, and we agreed I should open this issue.
Version
26.2.5
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Anything else?
No response