Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

cant import catalog #20

Closed
AhmadManzoor opened this issue Feb 4, 2021 · 8 comments
Closed

cant import catalog #20

AhmadManzoor opened this issue Feb 4, 2021 · 8 comments
Assignees
Labels
api: recommendationengine Issues related to the googleapis/python-recommendations-ai API. external This issue is blocked on a bug with the actual product. type: question Request for information or clarification. Not an issue.

Comments

@AhmadManzoor
Copy link

i am trying to import my catalog ( which i uploaded to bucket as json format) but it gives error
{"code":3,"message":"Parsing terminated before end of input.

i copied the data from sample json as given here
but the error is same.
here is my json which i copied from reference website
{ "id": "1234", "category_hierarchies": [ { "categories": [ "athletic wear", "shoes" ] } ], "title": "ABC sneakers" }}
{ "id": "5839", "category_hierarchies": [ { "categories": [ "casual attire", "t-shirts" ] } ], "title": "Crew t-shirt" }}
and here is the error

{"code":3,"message":"Parsing terminated before end of input.\n: \"ABC sneakers\" }}\n ^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":1}}]} {"code":3,"message":"Parsing terminated before end of input.\n: \"Crew t-shirt\" }}\n ^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":2}}]}

i will really appreciate any help

@product-auto-label product-auto-label bot added the api: recommendationengine Issues related to the googleapis/python-recommendations-ai API. label Feb 4, 2021
@busunkim96
Copy link
Contributor

Hi @AhmadManzoor,

It looks like Protobuf raises that error if the JSON has errors. https://github.com/protocolbuffers/protobuf/blob/a530dbe50c8295bf7b19e245b9be8525e235e6cb/src/google/protobuf/util/internal/json_stream_parser.cc#L221-L232

// Parse the remainder in finishing mode, which reports errors for things like
// unterminated strings or unknown tokens that would normally be retried.

Can you double-check that the JSON is exactly as you've shown in your post?

{"id": "1234", "category_hierarchies": [ { "categories": [ "athletic wear", "shoes" ]  } ], "title": "ABC sneakers"}}
{"id": "5839","category_hierarchies": [ { "categories": [ "casual attire", "t-shirts" ]  } ], "title": "Crew t-shirt"}}

Could you also share the code you are using to import the catalog?

@busunkim96 busunkim96 self-assigned this Feb 5, 2021
@busunkim96 busunkim96 added the type: question Request for information or clarification. Not an issue. label Feb 5, 2021
@AhmadManzoor
Copy link
Author

thank you so much @busunkim96 for your quick response
actually i am uploading the catalog online. i.e using gcp console and then selecting data and then clicking import ant then selecting json file in bucket.
and i have copied the code from the website and i am using exact same json.
Logically you are right and so is error as json is not valid. thats the problem i wanted to report that maybe online documentation has incorrect json example.

@busunkim96
Copy link
Contributor

Ah I see. Thank you for the clarification. I've opened an issue on that documentation page. I'll let you know once I hear back from the Recommendations AI team.

Googlers see 179488637.

@busunkim96 busunkim96 added the external This issue is blocked on a bug with the actual product. label Feb 5, 2021
@AhmadManzoor
Copy link
Author

So any suggestion how can i upload the catalog now? as i have deadline in few days.

@busunkim96
Copy link
Contributor

Apologies, I'm not familiar with this product so I won't be able to offer further assistance until I hear back from the API team. If you have a support contract with Google, please do file a ticket https://cloud.google.com/support.

@AhmadManzoor
Copy link
Author

Now i tried with valid json. i cheked it via jsonlint.com
{ "id": "WAG127836FN", "title": "Quasars IV", "categoryHierarchies": "" }, { "id": "WAG127833FN", "title": "Quasars I", "categoryHierarchies": "" }]

but still it is giving this error

{"code":3,"message":"Unexpected end of string. Expected a value or ] within an array.\n\n^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":1}}]} {"code":3,"message":"Unexpected end of string. Expected an object key or }.\n\n^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":2}}]} {"code":3,"message":"Parsing terminated before end of input.\n \"id\": \"WAG127836FN\",\n ^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":3}}]} {"code":3,"message":"Parsing terminated before end of input.\n \"title\": \"Quasars IV\",\n ^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":4}}]} {"code":3,"message":"Parsing terminated before end of input.\ncategoryHierarchies\": \"\"\n ^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":5}}]} {"code":3,"message":"Unexpected token.\n},\n^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":6}}]} {"code":3,"message":"Unexpected end of string. Expected an object key or }.\n\n^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":7}}]} {"code":3,"message":"Parsing terminated before end of input.\n \"id\": \"WAG127833FN\",\n ^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":8}}]} {"code":3,"message":"Parsing terminated before end of input.\n \"title\": \"Quasars I\",\n ^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":9}}]} {"code":3,"message":"Parsing terminated before end of input.\ncategoryHierarchies\": \"\"\n ^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":10}}]} {"code":3,"message":"Unexpected token.\n},\n^","details":[{"@type":"type.googleapis.com/google.protobuf.Struct","value":{"line_number":11}}]}

@parthea
Copy link
Contributor

parthea commented Mar 27, 2021

Hi @AhmadManzoor ,

As a test, could you try changing from

{ "id": "1234", "category_hierarchies": [ { "categories": [ "athletic wear", "shoes" ] } ], "title": "ABC sneakers" }}
{ "id": "5839", "category_hierarchies": [ { "categories": [ "casual attire", "t-shirts" ] } ], "title": "Crew t-shirt" }}

to

{ "id": "1234", "categories": "Apparel & Accessories > Shoes", "title": "ABC sneakers" }}
{ "id": "5839", "categories": "casual attire > t-shirts", "title": "Crew t-shirt" }}

busunkim96 pushed a commit that referenced this issue Mar 29, 2021
fix: BREAKING rename `PriceRange.min` to `PriceRange.min_`, `PriceRange.max` to `PriceRange.max_`

fix: fix bug with enums closes #14, #20

feat: add async clients

feat: add common resource helper methods
@parthea
Copy link
Contributor

parthea commented May 18, 2021

Closed via #22

@parthea parthea closed this as completed May 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: recommendationengine Issues related to the googleapis/python-recommendations-ai API. external This issue is blocked on a bug with the actual product. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

3 participants