lexiconhq/lexicon

Mutations Fail due to JSON.stringify after upgrading axios 0.19.2 -> 0.21.2

Closed this issue · 0 comments

It appears that after upgrading axios (due to dependabot warnings) from 0.19.2 to 0.21.2, all backend mutations return an error from Discourse.

The errors from Discourse tend to reflect an empty payload, such as the request for a new topic returning an error indicating that no title was set—even though one was definitely set.

After some investigation, this is due to the fact that we were calling JSON.stringify on all of our endpoints when params were involved.

I haven't confirmed, but since the changelog for axios indicates some improvements to their JSON handling, perhaps our payload is getting doubly-stringified. When Discourse receives it and attempts to extract properties from it, it would still be a string.

This could explain why Discourse thinks we haven't sent the required parameters. However, this has not yet been confirmed.