Closed markusEmm123 closed 7 months ago
Hello @markusEmm123 Unfortunately I'm not able to reproduce, it works fine on my side, with the same software versions:
I thought it was because description/keywords field had too many chars but that's not the case.
What are your IPN settings?
Is the IPN already used maybe? What do you have for the full Ki-nTree output?
[MAIN] Generating Internal Part Number
[INFO] Internal Part Number = ICS-000020-00
[INFO] Success: Added new part to InvenTree
[INFO] Warning: Image download failed (HTTP Error)
IPN settings are identical to the ones in your screenshot. Regex for IPN in Inventree is "([A-Z]{3,4})-([0-9]{6})-([0-9]{2})", so should match that. Next free IPN is not yet in use. I don't see any output in Ki-nTree; it seems like the program does not reach that stage in the program flow.
I also activated the "allow double IPNs" setting in Inventree, still the same error. Removing parameters with "special" characters (e.g. the URLs to datasheets) did not change anything. Replace IPN-Regex with .* (which should allow anything) still yields the same error. Tick "Check for existing part" in Ki-nTree ends with the same error message. Remove all "Checkbox" parameters in Inventree changes nothing in the behaviour. Removing the units from the parameters in Inventree changes nothing.
I don't get a status display within Ki-nTree's main output window, only the always identical "HTTPError" in the background console.
Any ideas what else i could try?
I also can not reproduce this. I am running InvenTree 0.12.9 but this should not make a difference on the requests send out by Ki-nTree. Does the error only happens on this part or on others as well?
To debug this further we probably need to adjust the base code a bit to get more comprehensive debugging messages out. Do you have any experience with Python programming?
The error stays the same with other parts (from other Inventree categories, so with different part parameters).
I have some experience in Python programming. The last request (payload) that is sent (through inventree\api.py) is
- params: {'format': 'json'}
- timeout: 10
- headers: {'AUTHORIZATION': 'Token MyToken'}
- auth: None
- proxies: None
- json: {'name': 'EP5WS10RJ', 'description': 'Drahtwiderstände - Durchgangsloch EP 5W (S) 10R 5%', 'category': 38, 'keywords': 'Drahtwiderstände - Durchgangsloch EP 5W (S) 10R 5%', 'revision': 'A', 'active': True, 'virtual': False, 'component': True, 'purchaseable': True}
That matches with the code 500 response code content. I see no IPN in there but I assume that is defined after the part is initially created (so we know the part number).
I'm starting to think that i might have misconfigured something within Inventree and set a parameter to required which is not transmitted or something like that.
What debug output do we need?
I'm starting to think that i might have misconfigured something within Inventree and set a parameter to required which is not transmitted or something like that.
I think this is it. I was able to reproduce your error after setting the IPN Regex
under Inventree Settings --> Global Settings --> Parts (requires admin rights). If set this requires an IPN while creating a part while Ki-nTree only adds the IPN later as you observed correctly.
There could be ways around this, e.g. by generating the IPN before creating a part with the ID of the last part in the database but I think this could be quite low performant. What do you think @eeintech?
A placeholder IPN for part generation could be also an idea but this does not really prevent this error as this placeholder still would have to comply with whatever the admin set for the InvenTree server regex.
Hi, removing the Regex fixed the problem indeed. But with the regex it worked up to 1.0.0rc with an older Inventree version (i think) 11.x or an early 12.x Was there a change in the way Ki-nTree (resp. the Python interface) creates the parts or was the change on Inventree-server side?
this part of Ki-nTree was stable for at least this whole year. Considering InvenTree changed a lot on how the API interacts with the database this year, especially on the switch from 0.11.x to 0.12.0, I wouldn't be surprised if this is one of the consequences we hadn't seen yet.
Do we send an empty IPN or no IPN at all? Extending the Regex to accept an empty IPN should be possible. But the error message looks like we are not sending anything at all, if i had to guess...
Getting the highest current number and then creating a new article with article number +1 yields a risk for race condition at parallel usage. Not a problem for me at the moment, but might become one in the future. Maybe we can send an empty IPN or dummy IPN and change the IPN afterwards.
Atm no IPN is send at all. If an empty IPN works while a IPN regex is set this could be an idea but I have not tested this. The only minor problem I could see is an error in the case there is already a part without an IPN in the database and the Allow Duplicate IPN
setting in InvenTree is deactivated.
Dummy IPN has the problem that Ki-nTree needs to know the pattern of the regex, so it would probably need another user setting as the setting can be retrieved via API but only if the user has staff status and I don't want to limit Ki-nTree only to users with staff access.
Dummy IPN has the problem that Ki-nTree needs to know the pattern of the regex, so it would probably need another user setting as the setting can be retrieved via API but only if the user has staff status and I don't want to limit Ki-nTree only to users with staff access.
I personally would find it acceptable to have (for a few seconds) a part which follows the IPN-scheme set up in Ki-nTree just with something like 000 or 999999 as part number. If we want to adhere to the regex we would need to know it anyway (also with the current workflow). Right now it works to just let the user set up the Inventree and Ki-nTree configuration accordingly (except for the case where we try to send no IPN).
True, allowing the InvenTree regex to not match the IPN how it is currently generated by ki-nTree probably would need a complete rework of this aspect anyway and would be complicated to say at least. So we only support regex matching the structure of Ki-nTrees IPNs and add a note to the docs which makes this clear.
added the server regex support to my pull request. should be part of the next release.
Thanks for the fix, seems to work!
After upgrading to Inventree 12.8 and Ki-nTree 1.0.4, Kintree halts with an error response from Inventree when i try to create a new part:
(inventree-server.tld is the correct server name, i replaced it for privacy reasons; test connection to inventree server works).
Inventree shows an error
I'm not too sure where to look for further details an not even if this is caused by Inventree or Kintree.
I'm using Inventree 0.12.8 and Kintree 1.0.4
I see no IPN being transmitted to the Inventree API and that would somehow fit the error description in the Inventree error, but I'm not sure if that has to mean anything.
I would be very grateful for hints where to search for the cause or how to narrow down the problem so i can continue using this great piece of software :)