Skip to content

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

@zamrokk

Description

@zamrokk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions