Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug: Jstz server cannot process POST requests with body. erro of json deserialization #609

Open
zamrokk opened this issue Oct 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@zamrokk
Copy link

zamrokk commented Oct 21, 2024

Is there an issue with body: Uint8Array on the POST command ?

If I get a body from a response on the jstz node, I can extract it this way on my webapp and it works
Buffer.from(result.body).toString()

But if I pass the body on a POST call like this one, then I have an error

const result = await new Jstz(endpoint).run(user, {
        uri: uri,
        method: "POST",
        body: Buffer.from(JSON.stringify({
          option,
          amount
        }))

=>

[HTTP/1.1 400 Bad Request 3ms]
Json deserialize error: invalid type: map, expected a sequence at line 1 column 404

I don't even hit the smart function otherwise, I should see a log on it, I suppose that it is the Jstz node that is not able to process the POST request

I added more logs and it seems that the problem is on the Jstz Rust code (I cannot debug).
You can reproduce it : https://github.com/zamrokk/polymarktez
Redeploy the index.ts contract from the root directory to Jstz node
2. then point to your new contract address on the ./polymarktez/src/App.tsx l10 const DEFAULT_URI = "tezos://tz1iLrb3CbYjuBQBvhKGj5SpuyXAjzK63Jps";
3. send money to tz1eVqP1XNL9SCrrgkXgV5ZcteSULwiykDZ8 (the default user)
On the bottom button of the page, you have a simple PING call, just to check that all is fine and :large_green_circle:
If :large_green_circle:, then select an amount and click on button BET
you should receive this on the browser console and no logs on the smart function traces

z-browser-179713602035-7922456870257-7c6329fb052f83d41f4468e31e44f0c02f6a8ed8bcd63995d4798571df3195bb

@zamrokk zamrokk added the bug Something isn't working label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant