Azure / data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
https://aka.ms/dab/docs
MIT License
947 stars 196 forks source link

[Bug]: Data API fails for requests with unusual HTTP request headers #2450

Open gvas opened 2 weeks ago

gvas commented 2 weeks ago

What happened?

Calling the data API from a webapp running in Facebook Messenger's in-app browser fails. That in-app browser uses the following User-Agent header:

Mozilla/5.0 (Linux; Android 11; SM-A202F Build/RP1A.200720.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/130.0.6723.60 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/482.0.0.71.108;]

Requests with this User-Agent header cause Internal server error in the Data API.

Image

In addition the error isn't added into the configured appinsights logs.

The same request with a simple "Mozilla/5,0" UA header works:

Image

Version

Microsoft.DataApiBuilder 1.2.11+c7ca8db8558a63919c530e454c8f18b45d5b931c

What database are you using?

Azure SQL

What hosting model are you using?

Static Web Apps (SWA)

Which API approach are you accessing DAB through?

REST, GraphQL

Relevant log output

GET /data-api/rest/Race?$filter=ActiveFrom%20le%202025-01-01T00:00:00.000Z%20and%20ActiveTo%20gt%202024-11-05T22:29:43.354Z&$select=Id,ActiveFrom,ActiveTo HTTP/1.1 User-Agent: Mozilla/5.0 (Linux; Android 11; SM-A202F Build/RP1A.200720.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/130.0.6723.60 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/482.0.0.71.108;] Cache-Control: no-cache Postman-Token: a7b37408-f9a9-4282-940c-4d1f83e33c69 Host: 4evszak5verseny.hu Connection: keep-alive

HTTP/1.1 500 Internal Server Error Content-Type: application/json Date: Wed, 06 Nov 2024 09:52:04 GMT Transfer-Encoding: chunked

{"Message":"InternalServerError","ActivityId":"9ef44b97-21ed-4874-964c-383326a38ce5"}

Code of Conduct

abhishekkumams commented 2 weeks ago

@neeraj-sharma2592, can you check if it is related to SWA?