Bug in upsertSimple API
I get this error sometimes when trying to insert pages - but I'm not specifying the slug - Talkyard is producing it.
"Invalid values, or combinations of values, in the uploaded json: Slug too long, length: 183, max: 100"
- KajMagnus @KajMagnus2020-02-18 21:18:11.920Z
What are the consequences of this? (I hope this doesn't completely block something else?)
It could be good to know what are the titles of some of those topics?
Definitely Talkyard shouldn't try to create such long slugs, or should at least truncate them
- CChristian Scheuer @chrscheuer
The consequence is that the page doesn't get created and so it's completely blocking our integration right now causing users to file new bugs that the bug reporting system is not working.
- Progresswith handling this problem
- KajMagnus @KajMagnus2020-02-19 05:57:15.473Z
Seems I can repro this, by upserting a page with a long title:
POST http://e2e-test-site.localhost/-/v0/upsert-simple, headers: {"Authorization":"Basic dGFsa3lhcmRJZD0yOnB1YmxpY0UyZVRlc3RTZWNyZXRLZXlBYmMxMjM="} ... [TyME2EPOST] curl \ -X POST \ -H 'Content-Type: application/json' \ -H 'Authorization: Basic dGFsa3lhcmRJZD0yOnB1YmxpY0UyZVRlc3RTZWNyZXRLZXlBYmMxMjM=' \ -d '{"pages":[{"extId":"ups_page_one_ext_id","pageType":15,"categoryRef":"extid:cat_ext_id","authorRef":"username:owen_owner","title":"UpsPageOneTitle 123456789 123456789 123456789 123456789 123456789 123456789zzzzzzzzzzzzzzz 123456789 123456789 123456789 123456789 123456789 123456789zzzzzzzzzzzzzzz 123456789 123456789 123456789 123456789 123456789 123456789zzzzzzzzzzzzzzz 123456789 123456789 123456789 123456789 123456789 123456789zzzzzzzzzzzzzzz 123456789 123456789 123456789 123456789 123456789 123456789zzzzzzzzzzzzzzz 123456789 123456789 123456789 123456789 123456789 123456789qqqqqqqqqqqqqqq 123456789 123456789 123456789 123456789 123456789 123456789","body":"UpsPageOneBody"}]}' \ http://e2e-test-site.localhost/-/v0/upsert-simple POST request failed to http://e2e-test-site.localhost/-/v0/upsert-simple [EsE5GPK02] Response status code: 400 (should have been 200) Response body: ——————————————————————————————————————————————————————————————————— 400 Bad Request Invalid values, or combinations of values, in the uploaded json: Slug too long, length: 525, max: 100, the slug: "upspageonetitle-123456789-123456789-123456789-123456789-123456789-123456789zzzzzzzzzzzzzzz-123456789-123456789-123456789-123456789-123456789-123456789zzzzzzzzzzzzzzz-123456789-123456789-123456789-123456789-123456789-123456789zzzzzzzzzzzzzzz-123456789-123456789-123456789-123456789-123456789-123456789zzzzzzzzzzzzzzz-123456789-123456789-123456789-123456789-123456789-123456789zzzzzzzzzzzzzzz-123456789-123456789-123456789-123456789-123456789-123456789qqqqqqqqqqqqqqq-123456789-123456789-123456789-123456789-123456789-123456789" [error DwE4KE32] [EsE7BJSN4] ——————————————————————————————————————————————————————————————————————————————————
So, Talkyard converts the title to a slug, but also needs to shorten the slug to < 100 chars. I could fix this and release a new version now soon? (maybe later today or, more likely, tomorrow)
Alternatively, something in SoundFlow seems to have started generating pretty long topic titles, > 100 chars? If you want a really quick fix, I'd think the quickest way to get that done, is that SoundFlow truncates the titles to say 80 chars?
- CChristian Scheuer @chrscheuer
We're talking about user content here. The titles are typed in by users.
We wouldn't be able to change this without forcing users to type fewer chars which would not be possible to change before a whole new product release cycle, so I don't agree that that is the fastest way to fix it.
If the API does not have a restriction on title length but has it on slug length and the TY server is responsible for generating the slug when we don't specify it (which is this case), I would say it's a clear bug in the API, not in our usage of the API.
We encourage users to give descriptive titles in the bug reporting system, I suspect that's why they get a little longer sometimes (although I can't really measure this since the topics never get created).
But if there's not a limitation to the title length in the API, we shouldn't be able to hit errors in other fields that we're not even specifying.
The whole point of me not wanting to specify slugs in the first place was to feel sure that TY would be handling all the potential pitfalls of correct slug generation internally. - CChristian Scheuer @chrscheuer
Ideally, for us, whatever slug generation mechanism you apply would just never fail based on user input.
Ie. we'd like for topic creation to always work, and then if there are field rules that aren't followed to the point, then content should still be created, just with changes made by the TY server to enforce the rules.
The problem with error messages from the API is that we lose all the upside of integrating with the forum if we can't trust the sync to go through every time (cause then we need to spend a lot of time programming our own system which then effectively would replace the forum). - KajMagnus @KajMagnus2020-02-19 07:20:22.198Zreplies tochrscheuer⬆:
Ok, good points. I'm fixing this bug now.
- KajMagnus @KajMagnus2020-02-22 05:49:36.781Zreplies tochrscheuer⬆:
This now fixed, fix deployed yesterday. (If you want to, you could create a dummy test topic ? With an 120 chars title > 100 chars)
- CChristian Scheuer @chrscheuer
Awesome! Confirmed fixed :) Thank you !!