Found issue with constant errors on API  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Found issue with constant errors on API

Postby JuiceyBrucey » Mon Dec 02, 2024 9:10 am

7.2.1.0
SR 16
Hi, I have been constantly plagued by JIWA returning NULL on some inventory items, but not on others when using the same API method.
I have found out why. It is because the images in JIWA are stored as varbinary(MAX) in the database instead of using a URL to reference the file by filename and path to a CDN or similar.
Personally on many of my sites I use Amazon CDN and reference them by file path etc. This works well for me. The images can be pulled direct from the CDN when a page is rendered. They can be easily uploaded using their API.
One item in the database had 37,500 characters in the Picture field. Several others were the same.
Images that were 70KB, were fine, but some images were 1655KB or similar and these were the ones causing errors. I am not the one that inserts the images into JIWA, so have no control over image size or file type etc.
Once the field was made NULL by selecting the default image or SQL, the problem resolved. I then re-inserted the image and tried again, and sure enough it failed.
Just letting you know about this.
Thank you.
Cheers
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 188
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Re: Found issue with constant errors on API

Postby Mike.Sheen » Mon Dec 02, 2024 10:43 am

JuiceyBrucey wrote:7.2.1.0
SR 16
Hi, I have been constantly plagued by JIWA returning NULL on some inventory items, but not on others when using the same API method.
I have found out why. It is because the images in JIWA are stored as varbinary(MAX) in the database instead of using a URL to reference the file by filename and path to a CDN or similar.
Personally on many of my sites I use Amazon CDN and reference them by file path etc. This works well for me. The images can be pulled direct from the CDN when a page is rendered. They can be easily uploaded using their API.
One item in the database had 37,500 characters in the Picture field. Several others were the same.
Images that were 70KB, were fine, but some images were 1655KB or similar and these were the ones causing errors. I am not the one that inserts the images into JIWA, so have no control over image size or file type etc.
Once the field was made NULL by selecting the default image or SQL, the problem resolved. I then re-inserted the image and tried again, and sure enough it failed.
Just letting you know about this.
Thank you.
Cheers


Thanks, but you've not actually helped.

I don't know what error you are getting on which route(s) and how to reliably reproduce it.

Without that information we can't do anything to fix the issue if it still occurs in the current version of the software.

I can only guess that the problem is you get a 413 Content too large when performing a GET on /Inventory/{InventoryID}, and only when the image of the item is above 1.5MB. I can say right now I don't get that error, but perhaps there is something related to your environment or configuration that imposes a limit on response sizes smaller than what is typically the default.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Found issue with constant errors on API

Postby JuiceyBrucey » Mon Dec 02, 2024 11:11 am

Path is: Inventory/$inventoryID
HTTP 200 OK
Buffer returns NULL.

I have replicated the issue several times by inserting images and deleting them, substituting images with others etc. It is definitely the image field.
I am not aware of any config settings for limitations on image size in JIWA.
I could use a plugin which excludes that field, but I going to NULL the Picture field in all records as the image feature is not really used to any great advantageous purpose on the current installation as the relevant images are on the website or the CDN.
So problem solved. Was just letting you know in case others run into that problem.
Cheers
JuiceyBrucey
Frequent Contributor
Frequent Contributor
 
Posts: 188
Joined: Tue Aug 18, 2020 7:19 pm
Topics Solved: 1

Re: Found issue with constant errors on API  Topic is solved

Postby Mike.Sheen » Thu Dec 05, 2024 3:46 pm

JuiceyBrucey wrote:I have replicated the issue several times by inserting images and deleting them, substituting images with others etc. It is definitely the image field.


I've done the same thing and I don't experience the same issue.

I couldn't actually find an image big enough to cause an error, so I instead managed to only get an error after adding a 200MB document to the inventory item and then tried a GET on /Inventory/{InventoryID} - and when I did that I got an error - as seen in the image below from Postman.

Postman_MaxSize.png


If you do the same thing from Postman do you get a 200 OK still?

JuiceyBrucey wrote:I am not aware of any config settings for limitations on image size in JIWA.


There isn't - but I was referring to environments imposing the limit. You can change the limit imposed by .NET by editing the JiwaAPISelfHostedService.exe.config file. I wouldn't recommend that, however - if you're exceeding the .NET default limits for response sizes then you're doing something wrong.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 2 guests