replaysMike / Binner

Open source parts inventory system for makers, electronics hobby, and professional engineers
https://binner.io
GNU General Public License v3.0
268 stars 41 forks source link

API error #149

Closed pdo59 closed 1 year ago

pdo59 commented 1 year ago

Hi Mike, I have this error: API Error Status: 500 - No message was specified. Api Endpoint: https://binner.win:8090/part/info?partNumber=ECC83&supplierPartNumbers=digikey:,mouser:,arrow:null

I don't understand why this happens, I created a new component, added some photos and datasheet, everything looks correct, but when I search for this component the response is API error and the module is unusable (with progress indicator in the boxes" Part Metadata", "Private Part Information" and "Suppliers" ).

I have enabled: Octopart/Nexar, Mouser, Digikey and Swarm APIs.

replaysMike commented 1 year ago

Hmm, that's a good question. Smells like a bug somewhere. One thing to check will be the system log, located by default in C:\Binner\Binner.log. You should be able to see the actual error and stacktrace and that would lead me to finding where the bug is. Can you post the last error/exception in that file?

pdo59 commented 1 year ago

Attached the log files, weird, the Binner.log stopped logging 3 hours ago, but a few minutes ago I got the API error again. Binner.log Binner.Microsoft.log Binner-internal.log

replaysMike commented 1 year ago

Looks like the swarm api searches have been throttled (too many requests), and the DigiKey api is returning BadRequest (either because it's also throttling requests or due to some kind of unhandled error).

It doesn't seem to be returning any details on the DigiKey error. Is it possible you've made a ton of requests? On Binner's side it should have displayed a friendly error/warning so I will take a look at that once I'm at my computer

replaysMike commented 1 year ago

I should note, to get around the Swarm api throttle limit you can create a free account on Binner.io and generate your own api key - this will get you higher request limits. Add the key on the Settings page in Binner

pdo59 commented 1 year ago

I generated the api key but with the new key the error is the same. So I disabled all API in settings but the error is still there. Are there any other tests I can do? If I try to add a new component the program runs fine.

pdo59 commented 1 year ago

The API error is still there, I can't insert or edit any part. I tried to change the db provider and used "Binner" instead of MySql, but the result is the same. I also installed version 2.3.5 with the same results. Please help me.

replaysMike commented 1 year ago

This is definitely not usual, I can take a closer look at this in a few hours as I'm away from home for a little bit. We will get it sorted out shortly

pdo59 commented 1 year ago

If it helps, I noticed that the Octopart API had reached its query limit, disabling these APIs didn't change anything, so I deleted the keys and it seemed to fix. But then, reloaded my db via SQL, I keep getting the error message.

pdo59 commented 1 year ago

Hello Mike, to replicate the error I did this:

I think there is a problem with this "partsuppliers" table when the part has no information available from the API. Hope this can help you solve the problem.

pdo59 commented 1 year ago

Hello Mike, another possible clue to troubleshooting the API error. The API error occurred while adding new parts, so I tested in "Settings" all configured APIs. The Swarm API said: Test failed - Unexpected character encountered while parsing value: <. Path '', line 0, position 0. I disabled the Swarm API and everything works fine.

replaysMike commented 1 year ago

Yup, I think this is caused by the swarm api being currently down. It's getting an upgrade but I ran into some .net 7.0 runtime issues, so the server is offline. It should be back up in 15 min

replaysMike commented 1 year ago

It's really weird, says that there is no .Net 7.0 framework installed on the server - but there is lol. Still debugging.

pdo59 commented 1 year ago

Ok. Please read my previous comment about the partsuppliers table

replaysMike commented 1 year ago

trying to repro now

replaysMike commented 1 year ago

Repro succeeded! Excellent repro details man, looks like a bug specifically with the MySql provider trying to convert a System.Single to a Nullable.

Will fix and deploy today!

pdo59 commented 1 year ago

Happy to be helpful! Your Binner is a beautiful product, and I'd like to use it well, so if you like, I'll gladly help you find bugs to make it more efficient.

replaysMike commented 1 year ago

and I appreciate the patience and help with working out these issues. It's an army of one over here, so I don't always get to test everything thoroughly as I'd like.

Fix is building now, will be deployed within about 30 minutes. This bug was isolated to MySql only