getredash / redash-toolbelt

API client and utilities to manage a Redash instance
BSD 2-Clause "Simplified" License
140 stars 74 forks source link

redash-migrate users "could not create user: probably this user already exists but is not present in meta.json" #73

Open mvsleak opened 3 years ago

mvsleak commented 3 years ago

Under the hood, this is the full error message including the exception:

Could not create user: probably this user already exists but is not present in meta.json 429 Client Error: TOO MANY REQUESTS for url: http://13.228.231.8//api/users?no_invite=1
   importing: 365880

I can see this kind of error was expected and this comment shows how this can be fixed: https://github.com/getredash/redash-toolbelt/pull/23#discussion_r714044129

However, even after setting RATELIMIT_ENABLED=False in redash (in /opt/redash/env for AWS AMI) I am still getting rate limited with the same message. What did change, however, is how many calls succeeded before getting rate limited. Before disabling RATELIMIT_ENABLED rate limit would kick in after creating 50 users, and after, it would start after creating 100 users.

shibacow commented 3 years ago

I faced the same problem.I tried REDASH_RATELIMIT_ENABLED=false in /opt/redash/env . It worked as expected.

https://github.com/getredash/redash/blob/9c928bd1d3f00c994f37e1a87edaddd646259f56/redash/settings/__init__.py#L310

According to the source code, the environment variable to be set seems to be REDASH_RATELIMIT_ENABLED.

susodapop commented 3 years ago

@shibacow is correct. The environment variable is called REDASH_RATELIMIT_ENABLED. This is then mapped to a Python constant called RATELIMIT_ENABLED. If you set an environment variable without REDASH_ appended to it, I would not expect this to have any effect.

@mvsleak Can you can confirm?

susodapop commented 3 years ago

Would appreciate a review on https://github.com/getredash/redash-toolbelt/pull/81 from either of you 👍

mvsleak commented 2 years ago

I confirmed using REDASH_RATELIMIT_ENABLED fixes the issue. Thanks a lot!