lexiconhq / lexicon

Built with Expo, React Native, and GraphQL, Lexicon is a pre-built mobile discussions app that you can customize for your users.
https://lexicon.is
MIT License
177 stars 31 forks source link

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

Closed Kinostrome closed 1 year ago

Kinostrome commented 1 year ago

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.