Closed LalitLab closed 1 year ago
'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.'
'This issue was closed because it has been stalled for 90 days with no activity.'
Relevant slack thread - https://steampipe.slack.com/archives/C01UECB59A7/p1658406892068329
Okta documentation on rate limit errors - https://github.com/okta/okta-sdk-golang#connection-retry--rate-limiting
Caching the Okta tables prior to running the problematic query appears to workaround this issue, e.g.
steampipe query "SELECT COUNT(*) FROM okta_user"
steampipe query "SELECT COUNT(*) FROM okta_factor"
After a lot of research, we will now be abandoning this plugin, and opt for a manual script to extract the data out of Okta.
From what I can tell, it would seem that the plugin is aggressively querying the Okta API. In our current environment, we have around 800 users. Even with 800 users, assuming the plugin makes a single call, we should (theoretically) not even hit 1000 API calls, and thus not it the rate limit of the Okta API, yet somehow it would seem the plugin is not just making 1 API call per user.
Please add a mechanism to throttle the API queries, or identity the bug that is causing the plugin to make excessive calls to the Okta backend.
Hello @massyn, we are extremely apologetic for the radio silence on this issue. We could have definitely taken a better approach to fix this issue.
We have raised a PR -https://github.com/turbot/steampipe-plugin-okta/pull/80 wherein we are going to use the API retry mechanism provided by the Steampipe plugin SDK. We will test it out aggressively to make sure that we are able to handle the throttling of API queries.
Once again, sorry for the delay, we will look to get the fix out as early as possible đ.
@massyn @ciaran-finnegan apologies for the delay on this issue. I have raised a PR that fixes the rate limit issue - https://github.com/turbot/steampipe-plugin-okta/pull/80
Could you please give it a try by building it locally and let us know if it fixes your issue?
Hi @misraved - I am busy looking into this. Can you please clarify what is needed to be changed? The https://github.com/okta/okta-sdk-golang#connection-retry--rate-limiting page is specific to the Okta plugin, but there is no documentation yet on what to update on the okta.spc
file.
With a limit of 600 API calls per minute, what parameters need to be set?
Warning: failed to start plugin 'hub.steampipe.io/plugins/turbot/okta@latest': failed to decode connection config for connection 'okta':
Unsupported argument: An argument named "DefaultRetryConfig" is not expected here.
Thanks for the quick response @massyn đ. My apologies for not enlisting the steps to test out the https://github.com/turbot/steampipe-plugin-okta/pull/80.
okta.spc
file to test out the changes. After installing the plugin, please configure your credentials per https://hub.steampipe.io/plugins/turbot/okta#configurationgit clone https://github.com/turbot/steampipe-plugin-okta.git
cd steampipe-plugin-okta
git checkout fix-rate-limit-error
make
command.I'm afraid the issue still persist. See my log below.. I uninstalled the plugin, to be sure it is gone. I manually installed the new plugin, and ran the query. The error still occurred.
â ~ steampipe plugin uninstall okta
Uninstalled plugin:
* turbot/okta
Please remove this connection to continue using steampipe:
* /Users/massyn/.steampipe/config/okta.spc
'okta' (line 1)
â ~ cd tmp
â tmp cd steampipe-plugin-okta
â steampipe-plugin-okta git:(fix-rate-limit-error) make
go build -o ~/.steampipe/plugins/hub.steampipe.io/plugins/turbot/okta@latest/steampipe-plugin-okta.plugin *.go
â steampipe-plugin-okta git:(fix-rate-limit-error) steampipe query
Welcome to Steampipe v0.18.6
For more information, type .help
> SELECT DISTINCT
F.user_id
FROM
okta_factor F
WHERE
F.factor_type IN ('push','token:software:totp')
AND F.status = 'ACTIVE' ;
Error: rpc error: code = DeadlineExceeded desc = context deadline exceeded (SQLSTATE HV000)
+---------+
| user_id |
+---------+
+---------+
>
Thanks for the feedback @massyn đ. Let me take another dive into it and try to come up with a better solution đ.
Hello @massyn, I have pushed some more changes to the PR wherein I have reduced the max concurrency and added RetryConfig to hydrate configs. Could you please pull the latest code from the branch and retest your queries?
1. git pull origin fix-rate-limit-error
2. make
3. steampipe query
Hi @misraved - I am afraid it is still failing
â steampipe-plugin-okta git:(fix-rate-limit-error) git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Total 5 (delta 4), reused 5 (delta 4), pack-reused 0
Unpacking objects: 100% (5/5), 609 bytes | 121.00 KiB/s, done.
From https://github.com/turbot/steampipe-plugin-okta
d758c49..9624389 fix-rate-limit-error -> origin/fix-rate-limit-error
Updating d758c49..9624389
Fast-forward
okta/table_okta_group.go | 5 ++++-
okta/table_okta_user.go | 10 ++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
â steampipe-plugin-okta git:(fix-rate-limit-error) make
go build -o ~/.steampipe/plugins/hub.steampipe.io/plugins/turbot/okta@latest/steampipe-plugin-okta.plugin *.go
â steampipe-plugin-okta git:(fix-rate-limit-error) steampipe query
Welcome to Steampipe v0.18.6
For more information, type .help
> SELECT DISTINCT
F.user_id
FROM
okta_factor F
WHERE
F.factor_type IN ('push','token:software:totp')
AND F.status = 'ACTIVE' limit 10;
Error: rpc error: code = DeadlineExceeded desc = context deadline exceeded (SQLSTATE HV000)
+---------+
| user_id |
+---------+
+---------+
> SELECT DISTINCT
F.user_id
FROM
okta_factor F
WHERE
F.factor_type IN ('push','token:software:totp')
AND F.status = 'ACTIVE';
Error: rpc error: code = DeadlineExceeded desc = context deadline exceeded (SQLSTATE HV000)
+---------+
| user_id |
+---------+
+---------+
>
Thanks @massyn for the quick feedback, could you please share the plugin level logs for the above query?
Also, do you see similar errors when you try other tables like okta_user
, or is it just this table that returns the error?
Hi @misraved - Sorry for the delay, I had a business trip to attend to. Find attached the log as requested. It only happens with the okta_factor
table. From what I can tell, the plugin makes individual connections to the API for every user it finds in the okta_user
table, and this excessive API calls then results in the okta API causing the rate limit.
Apologies for the delay @massyn, let me take a quick look at the logs and see if I can find a pattern for these errors.
Thanks a lot for your help đ.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
Hello, @massyn; we have successfully identified the underlying cause of this issue. To resolve it, we need to implement a fix in the Steampipe SDK. We have already raised an issue for this and will provide updates on the progress.
The issue is waiting on https://github.com/turbot/steampipe-plugin-sdk/issues/572, once it is resolved we will reopen the issue đ.
Describe the bug
okta_user
andokta_factor
table fails withcontext canceled
errors. It seems to fail due to a timeout issue for a larger number of users in the account.There should be a better mechanism to retry for such errors.
Steampipe version (
steampipe -v
) Example: v0.3.0Plugin version (
steampipe plugin list
) Example: v0.5.0To reproduce Steps to reproduce the behavior (please include relevant code and/or commands).
Expected behavior A clear and concise description of what you expected to happen.
Additional context Slack thread