Closed MichaHumbel closed 2 years ago
Hey @MichaHumbel, which version are you currently using?
Hey @MichaHumbel, which version are you currently using?
nestjs-keycloak-admin: 1.8.6 Node: v17.8.0
I don't think it's possible in a not-ugly way. I totally understand where this is coming from. What I can come up with is:
Whole logic for detecting whether or not a request is coming from GraphQL is implemented in utils/extract-request.ts (https://github.com/anonrig/nestjs-keycloak-admin/blob/master/src/utils/extract-request.ts#L5)
Since extractRequest
function sits on top of the core logic of Nest.js applications (in all guards), I could not find a solution that does not duplicate existing code.
I believe there are some of the possible solutions (which might not be the best ones):
nestjs-keycloak-admin/graphql/guards
and nestjs-keycloak-admin/http/guards
@nestjs/graphql
package if the package is installed. If not, do not even try to understand if the request is a graphql request.I'd be happy to discuss all possible solutions and reduce the size of this package.
same question here.... I'm not using graphQL so I shouldn't be forced to manually add @nestjs/graphql;
Tried this out with versions: 1.8.2 and 1.8.6 (get same issue for both versions)
For the latest version(1.8.7) I have other problem related with a require that sits somewhere in the code:
/Users/bernardo/Documents/incubeta-repos/creamos-client-management-service/node_modules/nestjs-keycloak-admin/dist/main/service.js:18 const keycloak_admin_client_1 = __importDefault(require("@keycloak/keycloak-admin-client")); ^ Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/bernardo/Documents/incubeta-repos/creamos-client-management-service/node_modules/@keycloak/keycloak-admin-client/lib/index.js from /Users/bernardo/Documents/incubeta-repos/creamos-client-management-service/node_modules/nestjs-keycloak-admin/dist/main/service.js not supported. Instead change the require of index.js in /Users/bernardo/Documents/incubeta-repos/creamos-client-management-service/node_modules/nestjs-keycloak-admin/dist/main/service.js to a dynamic import() which is available in all CommonJS modules.
@P1K3N due to @keycloak/keycloak-admin-client
being a ESM only package after 19.x release, it's required you to use ESM mode with Node.
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
@anonrig But these links are all 404
@anonrig But these links are all 404
It seems the keycloak-nodejs-admin-client repository is moved: https://github.com/keycloak/keycloak-nodejs-admin-client
We get the following error when trying to start our application after installing the nestjs-keycloak-admin package:
Full Error
We can't use nestjs-keycloak-admin without installing graphql, even though we don't use graphql. It runs after installing graphql manually as a dependency in our project.
Is there any way to use this package without installing graphql manually?