bimmer_connected icon indicating copy to clipboard operation
bimmer_connected copied to clipboard

3 day httpx.HTTPStatusError: Server error '500 Internal Server Error'

Open sincze opened this issue 2 years ago • 3 comments

Describe the issue

Receiving an error message and no device info.

httpx.HTTPStatusError: Server error '500 Internal Server Error' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles/myVin/state' For more information check: https://httpstatuses.com/500

Expected behavior

Receive a valid JSON of the current BMW APP data

Which Home Assistant version are you using?

CLI

What was the last working version of Home Assistant Core?

N.A

What is your region?

Rest of world

MyBMW website

  • [X] I can still successfully login to the BMW MyBMW website and the car status is available there.
  • [X] I have MyBMW enabled for my vehicle.

Number of cars

  • [ ] I have 2 or more cars linked to the MyBMW account.
  • [ ] I have a Mini vehicle linked to my account.

Output of bimmer_connected fingerprint

/home/pi/.local/bin/bimmerconnected fingerprint  email pwd rest_of_world

DEBUG:asyncio:Using selector: EpollSelector
DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.api.authentication:Authenticating with MyBMW flow for North America & Rest of World.
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-ucs/v1/presentation/oauth/config "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/authenticate "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/authenticate "HTTP/1.1 302 Found"
DEBUG:httpx._client:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/token "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles "HTTP/1.1 200 OK"
Traceback (most recent call last):
  File "/home/pi/.local/bin/bimmerconnected", line 10, in <module>
    sys.exit(main())
  File "/home/pi/.local/lib/python3.7/site-packages/bimmer_connected/cli.py", line 286, in main
    loop.run_until_complete(args.func(args))
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/home/pi/.local/lib/python3.7/site-packages/bimmer_connected/cli.py", line 143, in fingerprint
    await account.get_vehicles()
  File "/home/pi/.local/lib/python3.7/site-packages/bimmer_connected/account.py", line 89, in get_vehicles
    await self._init_vehicles()
  File "/home/pi/.local/lib/python3.7/site-packages/bimmer_connected/account.py", line 75, in _init_vehicles
    for brand in CarBrands
  File "/home/pi/.local/lib/python3.7/site-packages/bimmer_connected/account.py", line 75, in <listcomp>
    for brand in CarBrands
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_client.py", line 1760, in get
    extensions=extensions,
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_client.py", line 1527, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_client.py", line 1618, in send
    history=[],
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
    history=history,
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_client.py", line 1700, in _send_handling_redirects
    raise exc
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
    await hook(response)
  File "/home/pi/.local/lib/python3.7/site-packages/bimmer_connected/api/client.py", line 53, in log_response
    await log_to_to_file(content, config.log_response_path, base_file_name)  # type: ignore[arg-type]
  File "/home/pi/.local/lib/python3.7/site-packages/bimmer_connected/api/utils.py", line 114, in log_to_to_file
    await logfile.write(anonymized_data)
  File "/home/pi/.local/lib/python3.7/site-packages/aiofile/utils.py", line 299, in write
    await operation
  File "/home/pi/.local/lib/python3.7/site-packages/aiofile/aio.py", line 274, in write_bytes
    data[written:], self.fileno(), offset + written,
  File "/home/pi/.local/lib/python3.7/site-packages/caio/asyncio_base.py", line 47, in submit
    assert self.context.submit(op) == 1, "Operation was not submitted"
ValueError: The AIO context specified by ctx_id is invalid. nr is less than 0. The iocb at *iocbpp[0] is not properly initialized, the operation specified is invalid for the file descriptor in the iocb, or the value in the aio_reqprio field is invalid. [EINVAL]

Anything in the logs that might be useful for us?

DEBUG:asyncio:Using selector: EpollSelector
DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.account:Getting vehicle list
DEBUG:bimmer_connected.api.authentication:Authenticating with MyBMW flow for North America & Rest of World.
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-ucs/v1/presentation/oauth/config "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/authenticate "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/authenticate "HTTP/1.1 302 Found"
DEBUG:httpx._client:HTTP Request: POST https://customer.bmwgroup.com/gcdm/oauth/token "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles "HTTP/1.1 200 OK"
DEBUG:httpx._client:HTTP Request: GET https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles/myVin/state "HTTP/1.1 500 Internal Server Error"
Traceback (most recent call last):
  File "/home/pi/.local/bin/bimmerconnected", line 10, in <module>
    sys.exit(main())
  File "/home/pi/.local/lib/python3.7/site-packages/bimmer_connected/cli.py", line 286, in main
    loop.run_until_complete(args.func(args))
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/home/pi/.local/lib/python3.7/site-packages/bimmer_connected/cli.py", line 106, in get_status
    await account.get_vehicles()
  File "/home/pi/.local/lib/python3.7/site-packages/bimmer_connected/account.py", line 98, in get_vehicles
    "bmw-current-date": fetched_at.isoformat(),
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_client.py", line 1760, in get
    extensions=extensions,
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_client.py", line 1527, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_client.py", line 1618, in send
    history=[],
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
    history=history,
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_client.py", line 1700, in _send_handling_redirects
    raise exc
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
    await hook(response)
  File "/home/pi/.local/lib/python3.7/site-packages/bimmer_connected/api/client.py", line 66, in raise_for_status_event_handler
    response.raise_for_status()
  File "/home/pi/.local/lib/python3.7/site-packages/httpx/_models.py", line 736, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Server error '500 Internal Server Error' for url 'https://cocoapi.bmwgroup.com/eadrax-vcs/v2/vehicles/myVin/state'
For more information check: https://httpstatuses.com/500

Additional information

Some time ago we had the 403 Quota reached so changed the request time to every 15 min. (pretty lame BMW...) I updated connected-drive and that all worked fine.

Since 3 days I now have this 500 issue.

sincze avatar Oct 09 '22 17:10 sincze

Update:

After taking a closer look at the log feedback I notice the following.

myVIN (the redacted version) is not actually MY VIN... myVIN is actually from a car that I test drove and used the DRIVER PROFILE. option of.

That car is not shown here: https://www.bmw.nl/nl-nl/mybmw/vehicle-overview this is where I see a picture of my car with my correct VIN number.

sincze avatar Oct 09 '22 17:10 sincze

I uninstalled the myBMW app and reinstalled it. That showed me: image

And has indeed the VIN of the offending article. I guess this is messing up the API.

sincze avatar Oct 09 '22 17:10 sincze

If you do a bimmerconnected fingerprint, is there any difference between the cars in the vehicles file?

rikroe avatar Oct 10 '22 06:10 rikroe

Contacted BMW and they noticed the problem being a GERMAN car added to a DUTCH , MyBMW account. After several tries where the customer services called me, BMW Germany solved the issue

sincze avatar Oct 15 '22 09:10 sincze

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Nov 15 '22 03:11 github-actions[bot]