I have a problem that many must've already faced, and that would be the lengths of strings that the shopify API returns.
They seem to be completely undocumented, making writing a model for a REST exchange extremely painful.
The most recent error I've encountered is a
ERROR: value too long for type character varying(255) Apr 08 18:29:12 le-rapp app/web.1 2020-04-08 18:29:11.855 ERROR 3 --- [io-3374...
Unfortunately, which exact column that appeared on gets masked in the exception process, so I am providing my table definition below, in hope someone recognizes an ill-defined field.
CREATE TABLE shopify_product ( id bigint NOT NULL, title character varying(1024), vendor character varying(255), handle character varying(255), product_type character varying(255), tags character varying(255), created_at timestamp with time zone, updated_at timestamp with time zone, shop_id bigint NOT NULL ); CREATE TABLE shopify_product_variant ( id bigint NOT NULL, product_id bigint NOT NULL, title character varying(1024), sku character varying(1024), price character varying(255), created_at timestamp with time zone, updated_at timestamp with time zone, taxable boolean, requires_shipping boolean, shop_id bigint NOT NULL );
Could anyone point me to a resource on the field lengths or correct my tables for product fields on which this is happening?
Solved! Go to the solution
Have you tried making a separate call using Postman to GET the problem resource? This should allow you to see the number of characters in each field and spot the discrepancy.
By just looking at your table, my guess is the
tags field is too short. The tags field is returned as a single string, and depending on the number of tags the merchant has used it's very possible to exceed 255 chars.
JB | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
|3 hours ago|
|4 hours ago|
|5 hours ago|
|5 hours ago|
|6 hours ago|