Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Comments

@AhmadManzoor
Copy link

@AhmadManzoor AhmadManzoor commented Feb 4, 2021

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

@busunkim96
Copy link
Collaborator

@busunkim96 busunkim96 commented Feb 5, 2021

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?

Loading

@busunkim96 busunkim96 self-assigned this Feb 5, 2021
@AhmadManzoor
Copy link
Author

@AhmadManzoor AhmadManzoor commented Feb 5, 2021

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.

Loading

@busunkim96
Copy link
Collaborator

@busunkim96 busunkim96 commented Feb 5, 2021

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.

Loading

@AhmadManzoor
Copy link
Author

@AhmadManzoor AhmadManzoor commented Feb 5, 2021

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

Loading

@busunkim96
Copy link
Collaborator

@busunkim96 busunkim96 commented Feb 5, 2021

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.

Loading

@AhmadManzoor
Copy link
Author

@AhmadManzoor AhmadManzoor commented Feb 5, 2021

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}}]}

Loading

@parthea
Copy link
Contributor

@parthea 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" }}

Loading

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 parthea commented May 18, 2021

Closed via #22

Loading

@parthea parthea closed this May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants