-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in @sap-cloud-sdk/connectivity version 3.18.0 #5026
Comments
Hi @BastiInnovation, I agree that the issue you are facing is likely caused by the referenced PR, however, after reviewing our code I do not see any change that would lead to your issue. The warning you are receiving indicates that the tenant look-up is failing. The only difference is that we now check for the Could you debug what your JWT contains and perhaps share a redacted version with us? |
Hi @tomfrenken, {
"jti": "01234567890123456789012345678901",
"ext_attr": {
"enhancer": "XSUAA",
"subaccountid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"zdn": "mytenant"
},
"sub": "sb-myapp!tnnnnn",
"authorities": [
"uaa.resource"
],
"scope": [
"uaa.resource"
],
"client_id": "sb-myapp!tnnnnn",
"cid": "sb-myapp!tnnnnn",
"azp": "sb-myapp!tnnnnn",
"grant_type": "client_credentials",
"rev_sig": "yyyyyyyy",
"iat": 1732607862,
"exp": 1732651062,
"iss": "https://mytenant.authentication.eu20.hana.ondemand.com/oauth/token",
"zid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"aud": [
"sb-myapp!tnnnnn",
"uaa"
]
} In the meantime, we fetch the destination as follows: return await getDestinationFromDestinationService({destinationName, iss: `https://${tenant}.localhost:8080/uaa/oauth/token`}) So we do not fetch the token by ourselves manually and instead delegate this to @sap-cloud-sdk/connectivity. But we'd anyways like to find out, why the well-known way of getting the destination doesn't work anymore. One more info, that might be the cause for the missing |
Hi @nocheintobi, we found the cause. Since we introduced support for IAS tokens, we check for different properties to build our cache key, based on the type of JWT (IAS or XSUAA). So for your specific use case, you can simply add this property to your call: token = await serviceToken('xsuaa', { jwt: { iss: `https://${tenant}.localhost:8080/uaa/oauth/token`, ext_attr.enhancer: 'XSUAA'}, useCache: true }); |
Thanks for your explanation @tomfrenken, That modification also has a positive side-effect to our local development environment, which I'd like to point out since it makes our lives much easier here: Before, we had to modify Thanks a lot for your support!!! |
Yeah that's a good point, I think when we introduced this change, the assumption was that it wouldn't make a difference for any "real" JWT coming from either the IAS or XSUAA, therefore we didn't mention it anywhere, I supposed we didn't take into account the potential impact on local testing setups. |
Describe the bug
After updating @sap-cloud-sdk/connectivity from version 3.17.0 to 3.18.0. The destination from
getDestinationFromDestinationService()
is null. In cloud foundry log i received a warning: "Cannot create cache key for client credentials token cache. The given tenant id is undefined".To Reproduce
Expected behavior
I expected to receive the destination from
getDestination()
because the token fromfetchToken()
is the right one.I think there is a relation to 4799, but I found non solution in the related documentation.
Used Versions:
node version: v20.11.0
sap-cloud-sdk/connectivity: v3.18.0
sap-cloud-sdk/util: v3.18.0
sap/cds: v7.9.4
sap/xssec: v3.6.1
The text was updated successfully, but these errors were encountered: