Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Keycloak.GrantedRequest no longer existing in keycloak typings #70

Open
wtrocki opened this issue Feb 25, 2020 · 12 comments
Open

Keycloak.GrantedRequest no longer existing in keycloak typings #70

wtrocki opened this issue Feb 25, 2020 · 12 comments
Assignees

Comments

@wtrocki
Copy link
Contributor

wtrocki commented Feb 25, 2020

No description provided.

@wtrocki wtrocki self-assigned this Feb 25, 2020
@wtrocki wtrocki closed this as completed Feb 26, 2020
@dgarciap
Copy link

dgarciap commented Sep 9, 2020

Hello,
I'm having an error related to this type on the next line:
const kauth = new KeycloakContext({ req });

Error:
Type 'Request<ParamsDictionary, any, any, ParsedQs>' is missing the following properties from type 'GrantedRequest': kauth, cache, credentials, destination, and 16 more

Is it solved?

I'm using:
"keycloak-connect": "^11.0.0", "keycloak-connect-graphql": "^0.6.1",

@heivo
Copy link

heivo commented Oct 1, 2020

@dgarciap have you found a solution? I'm having the same issue.

@wtrocki wtrocki reopened this Oct 1, 2020
@BasarN
Copy link
Contributor

BasarN commented Nov 5, 2020

same issue here, any workaround?

@wtrocki
Copy link
Contributor Author

wtrocki commented Nov 5, 2020

Strange. I cannot replicate that on sample app in the repo that uses the same version.

@BasarN
Copy link
Contributor

BasarN commented Nov 9, 2020

@wtrocki I'm using

"typescript": "^4.0.3",
"graphql": "^15.4.0",
"keycloak-admin": "^1.13.0",
"keycloak-connect": "^11.0.2",
"keycloak-connect-graphql": "^0.6.3",

The problem seems to occur when I use
import { KeycloakContext, KeycloakTypeDefs, KeycloakSchemaDirectives } from "keycloak-connect-graphql"
Instead of
const { KeycloakContext, KeycloakTypeDefs, KeycloakSchemaDirectives } = require('keycloak-connect-graphql')

I get cannot find name Request on GrantedRequest when using import

export interface GrantedRequest extends Request {
    kauth: {
        grant?: Grant;
    };
}

@wtrocki
Copy link
Contributor Author

wtrocki commented Nov 12, 2020

Our library exports our own typings. So typinings we can use should be coming from the library itself.
https://github.com/aerogear/keycloak-connect-graphql/blob/master/src/KeycloakTypings.ts

@wtrocki
Copy link
Contributor Author

wtrocki commented Nov 12, 2020

Oh.. but you should have express types. I guess reexporting this doesn't sound like bad plan.
Maybe we can create PR with the fix.

@erikSenseworks
Copy link

Woops deleted my last comment.

When adding import { Request } from 'express'; into KeycloakContext.d.ts everything works fine.
Do you have any tips what I can try/do to come around this problem?

To answer my question I'm currently using "@types/express": "^4.17.6"

@wtrocki
Copy link
Contributor Author

wtrocki commented Nov 12, 2020

I'm away from computer till next week so cannot check it. Sample app works. If you can add this to types and still make sample app work I can merge and resolve problem

@BasarN
Copy link
Contributor

BasarN commented Nov 12, 2020

Did add
import { Request } from 'express'
into
https://github.com/aerogear/keycloak-connect-graphql/blob/master/src/KeycloakContext.ts
worked on sample app.

When you say types do you mean
https://github.com/aerogear/keycloak-connect-graphql/blob/master/src/KeycloakTypings.ts ?

@wtrocki
Copy link
Contributor Author

wtrocki commented Nov 12, 2020

Superb. Sounds like PR will solve problem..
Will release it after

@BasarN
Copy link
Contributor

BasarN commented Nov 14, 2020

thx for quick merge!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants