dfinity / agent-js

A collection of libraries and tools for building software around the Internet Computer, in JavaScript.
https://agent-js.icp.xyz
Apache License 2.0
155 stars 96 forks source link

v2.1 having issues with "unhandled rejection" (on case of Result.Result<Text, Text> and old way of agent constructor) #933

Open tiagoicp opened 2 months ago

tiagoicp commented 2 months ago

Describe the bug On v2.0.0 no issue happens, but when I upgrade to v2.1.0 or v2.1.1, a strange exception happens when it receives the response back. It is only happening to this response, if the response is an array of ints for example, it works fine.

To Reproduce Steps to reproduce the behavior:

  1. Try to figure it out just by the screenshots. If not, then...
  2. Using Plug to authenticate and a backend in motoko with a Result.Result<Text,Text>, I suspect you will face the same error.

Expected behavior To behave as it was on v2, without any exception.

Screenshots

Screenshot 2024-09-17 at 22 00 10 Screenshot 2024-09-17 at 22 01 37

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Original repo where the incident happened (for more context on dependencies, sequence of code, etc.): https://github.com/obsidian-tears/obsidian_tears_frontend_backend/tree/c27b4552b1f1a33eb47c1afde3262b62b3f984d5