Closed cybercoder closed 2 years ago
Hey @cybercoder
This is related to @keycloak/keycloak-admin-client
making the decision to distribute their code with only ESM support (without CJS).
Please look into the issues https://github.com/keycloak/keycloak-nodejs-admin-client/issues/523, https://github.com/keycloak/keycloak-nodejs-admin-client/issues/519 and https://github.com/keycloak/keycloak-nodejs-admin-client/issues/487
for a workaround I've added:
"resolutions": {
"@keycloak/keycloak-admin-client": "^18.0.2"
},
to my package.json
file and run yarn
, Also added graphql
package.
And it's working. But it hadn't solve my problem with:
WARN [KeycloakService] Missing token set on refreshGrant.
How ever, thanks for your attention.
It seems the refreshGrunt function is calling somewhere before initialize, So for another workaround I've added
async refreshGrant() {
if (!this.tokenSet) await this.initialize();
....
to service.js file
And comment await client.initialize();
in the module.js file.
Can you open a pull request if this needs to be resolved on our side?
I've added a part to README to tell developers about the decision of ESM, and released a new version to stop distributing CJS on 2.0.0 (https://github.com/anonrig/nestjs-keycloak-admin/releases/tag/v2.0.0)
platform: mac os node version: v16.17.0 nestjs version: 9.0 nestjs-keycloak-admin version: 1.8.7 keycloak version: 19.0.1 keycloak docker image: quay.io/keycloak/keycloak:19.0.1