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

[BUG] KeyError when batchCreate results in errors #30

Open
wooooodward opened this issue Oct 12, 2021 · 0 comments
Open

[BUG] KeyError when batchCreate results in errors #30

wooooodward opened this issue Oct 12, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@wooooodward
Copy link

wooooodward commented Oct 12, 2021

Describe the bug
There's an uncaught KeyError when the batchCreate endpoint returns errors.

Traceback (most recent call last):
  File "/home/user/project/venv/lib/python3.7/site-packages/celery/app/trace.py", line 385, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/home/user/project/venv/lib/python3.7/site-packages/celery/app/trace.py", line 650, in __protected_call__
    return self.run(*args, **kwargs)
  File "/home/user/project/dispatch/tasks.py", line 18, in create_onfleet_tasks_from_run
    create_count, error_list = models.RunStop.tasks.batch_create(stops)
  File "/home/user/project/_onfleet/models.py", line 45, in batch_create
    response = api.tasks.batchCreate(body=dict(tasks=task_list))
  File "/home/user/project/venv/lib/python3.7/site-packages/backoff/_sync.py", line 94, in retry
    ret = target(*args, **kwargs)
  File "/home/user/project/venv/lib/python3.7/site-packages/ratelimit/decorators.py", line 80, in wrapper
    return func(*args, **kargs)
  File "/home/user/project/venv/lib/python3.7/site-packages/onfleet/request.py", line 62, in __call__
    error_request = error['message']['request']
KeyError: 'request'

To Reproduce
I had thought it was due to an error with the address but just retried the API call and it was completed successfully.

I've run into a similar problem with large batches but in this case the body only contained 10 tasks.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
v1.2

@wooooodward wooooodward added the bug Something isn't working label Oct 12, 2021
@wooooodward wooooodward changed the title [BUG] KeyError: ' [BUG] "request" KeyError when batchCreate results in errors' Oct 12, 2021
@wooooodward wooooodward changed the title [BUG] "request" KeyError when batchCreate results in errors' [BUG] KeyError when batchCreate results in errors Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant