Client throws error when server returns 404
# support
r
The client code throws an error when the server returns a 404 from an non-existent route (it works properly when the server returns a 404 from a non-existent resource). It tries to parse the response as JSON but the response is text: https://github.com/medplum/medplum/blob/0dfa5f4abb09719d371081b05e5227a8475b8c58/packages/core/src/client.ts#L2211 Working example: https://codesandbox.io/p/sandbox/gracious-sound-f3t3zh?file=%2Fsrc%2Findex.ts
searchable:
Copy code
Error parsing response 404 SyntaxError: Unexpected token < in JSON at position 0
Not sure if I should first report it here or directly on the project's GitHub repo.
r
@Raf thank you for bringing this to our attention! We've filed the ticket here and will track the progress in Github. https://github.com/medplum/medplum/issues/1981
r
Sounds good, @rahul1 ! 👍🏻
j
@Raf thank you again for taking the time to write this up. We just merged the new change https://github.com/medplum/medplum/pull/1985
r
Wow, that's quick! 🎉
thanks!
157 Views