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

CORS configuration not working for Tessera #153

Closed
wxker95 opened this issue Mar 9, 2022 · 3 comments
Closed

CORS configuration not working for Tessera #153

wxker95 opened this issue Mar 9, 2022 · 3 comments
Assignees

Comments

@wxker95
Copy link

wxker95 commented Mar 9, 2022

I have attempted to enable CORS by adding to the tessera config as shown below.

"serverConfigs": [
        {
            "app": "ThirdParty",
            "enabled": true,
            "serverAddress": "http://${HOSTNAME}:9080",
            "communicationType": "REST",
            "cors": {
                "allowedOrigins": ["*"]
            }
        }
        ...

However, trying to hit the /storeraw endpoint gave the following error:
Access to fetch at 'http:///storeraw' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

Seems like the preflight request resulted in a 500 status.

Looking in the tessera logs, I see the following lines:

{"timestamp":"2022-03-09 08:34:06,094","container":"5385ee3fbd59","level":"INFO","thread":"qtp178371348-25","logger":"o.g.j.s.w.p.WadlModelProcessor$OptionsHandler","message":"Enter Request : OPTIONS : /storeraw","throwable":""}
{"timestamp":"2022-03-09 08:34:06,240","container":"5385ee3fbd59","level":"ERROR","thread":"qtp178371348-25","logger":"c.q.t.a.e.DefaultExceptionMapper","message":"Error occurred: Unable to make protected jakarta.ws.rs.core.Response() accessible: module jakarta.ws.rs does not \"opens jakarta.ws.rs.core\" to module jersey.server. Root cause: Unable to make protected jakarta.ws.rs.core.Response() accessible: module jakarta.ws.rs does not \"opens jakarta.ws.rs.core\" to module jersey.server","throwable":""}
{"timestamp":"2022-03-09 08:34:06,241","container":"5385ee3fbd59","level":"INFO","thread":"qtp178371348-25","logger":"o.g.j.s.w.p.WadlModelProcessor$OptionsHandler","message":"Exit Request : OPTIONS : /storeraw","throwable":""}
{"timestamp":"2022-03-09 08:34:06,241","container":"5385ee3fbd59","level":"INFO","thread":"qtp178371348-25","logger":"o.g.j.s.w.p.WadlModelProcessor$OptionsHandler","message":"Response for storeraw : 500 Internal Server Error","throwable":""}
@joshuafernandes
Copy link
Contributor

joshuafernandes commented Mar 16, 2022

Hi @wxker95 could you confirm the request url you made please? http:///storeraw should instead be http://localhost:9080/storeraw ? or similar with an IP.

Could you please give us a list of steps as to how we reproduce this error?

@wxker95
Copy link
Author

wxker95 commented Mar 16, 2022

Hi @joshuafernandes

Can confirm that even though the error message shows http:///storeraw, it is hitting the correct endpoint. I know this because when using Quorum's 7 node example with a Tessera version of 0.10.2, I am able to use the storeraw API without issue with the same code. Not sure specifically which Tessera versions have this issue, but it is definitely not working on the main branch of Tessera.

I have tried modifying quorum quickstart's Tessera version to use 0.10.2, but I must not be understanding something about this project because I haven't been able to get it working.

The code I'm using:

import Web3 from "web3";
import Web3Quorum from "web3js-quorum";

const web3 = new Web3Quorum(
    new Web3(new Web3.providers.WebsocketProvider(<quorum websocket endpoint>)), 
    { privateUrl: <tessera url>}, 
    true
)
...
//error occurs here
const txHash = await web3.ptm.storeRaw({
      data: <encoded transaction>,
      privateFrom: [...],
});

It's worth noting that this is a known issue mentioned on Tessera's github since January: Consensys/tessera#1385
I created this issue here before finding it there

@joshuafernandes
Copy link
Contributor

Gotcha @wxker95 I'll close this and follow this up on that issue. Consensys/tessera#1385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants