Skip to content
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

better error message for context token generation #69

Closed
shazron opened this issue Apr 16, 2021 · 1 comment · Fixed by #70
Closed

better error message for context token generation #69

shazron opened this issue Apr 16, 2021 · 1 comment · Fixed by #70
Labels
enhancement New feature or request

Comments

@shazron
Copy link
Member

shazron commented Apr 16, 2021

Right now, if your context does not support the properties needed for the OAuth, or JWT IMS plugins, it will show this error:
Error: cannot generate token because no plugin supports configuration

This error is not very descriptive. There is more info when prefixing this environment variable DEBUG=@adobe/aio-lib-ims:token-helper before your command.

The IMS plugins do check for missing keys, and we can expose the missing keys in aio-lib-ims for reporting: https://github.com/adobe/aio-lib-ims-jwt/blob/f5028aa800c41f53aac663c4ccdcbae4c672263c/src/ims-jwt.js#L39

The issue is, if it is missing properties for a plugin, that's ok, it can match for another plugin. If it does not match all plugins, we need to print out the error message for all the plugins (missing key(s)), so the user can see and filter for themselves.

Expected

When an ims context does not match any IMS plugin, this error is shown:

context properties: ['...']
@adobe/aio-lib-ims-jwt: missing keys(s) ['private_key']
@adobe/aio-lib-ims-oauth: missing keys(s) ['scope', 'redirect_uri' ]

Actual

When an ims context does not match any IMS plugin, this error is shown:
Error: cannot generate token because no plugin supports configuration

@shazron shazron added the enhancement New feature or request label Apr 16, 2021
@aiojbot
Copy link
Collaborator

aiojbot commented Apr 20, 2021

JIRA issue created: https://jira.corp.adobe.com/browse/ACNA-1147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants