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

findMatch function returns error #62

Open
cmalfesi opened this issue Apr 15, 2020 · 8 comments
Open

findMatch function returns error #62

cmalfesi opened this issue Apr 15, 2020 · 8 comments
Assignees

Comments

@cmalfesi
Copy link
Contributor

@lacabra
Woking on the frontend I'm receiving an error. Using curl get also an error. I have checked the documentation and
curl -H "Content-Type: application/json" -d '{"method":"findMatch","jsonrpc":"2.0","params":{"encryptedUserId":"e8e7c1971b7bdb8d9d78df1b8b88f60f731f08688e47731f530df90756c07dbfdc8c9ca048c26f055843a0f1f07cc68d7700ad7b","userPubKey":"7b2d957d4fa5682067aeebdaee6c34e640e4ce4ae4f803f3f44bbbd95a50b4eecad0fbdc5c3e6c3879ac42249ddc71ecadaf45415588f0347c5c7b2f3a360d48"},"id":"dc4d0812-5e62-4607-8b5d-409eaca38ec4"}' https://safetrace.enigma.co

Error result:
image

This is the error on the frontend:
image

It is related to this PR #50

@lacabra
Copy link
Contributor

lacabra commented Apr 16, 2020

Thanks @cmalfesi for your report. I'm looking at this right now, and so far I can confirm that the server is up and running, and responding correctly to requests

@lacabra
Copy link
Contributor

lacabra commented Apr 16, 2020

@cmalfesi You are seeing two different errors here:

There is an error with the curl request that I am investigating. It causes a segmentation fault on the enclave, which then restarts, and results in the Bad Gateway that you are seeing, because the upstream server fails. This is not the error that we want to focus on here...

If you look at the Javascript code in the client/ folder, there is a script for to call findMatch, which works just fine. In your frontend code, the analogous requests fails because of CORS. This is the relevant error that we should tackle. I am curious: you should be seeing this same error for addPersonalData, is this correct? I would be surprised if you only see this error for findMatch. Can you please confirm?

@cmalfesi
Copy link
Contributor Author

@lacabra
I share here a small video that shows the steps and what endpoint is returning a problem.
Video of running frontend

Regarding the Javascript code in the client/, we were using that version but I had the CORS problem calling the endpoint 'addPersonalData' when with Curl it was working perfect, that is why I have improved the code and suggested to Alaa a new version of this file.
Updated enclave.js

@assafmo
Copy link
Member

assafmo commented Apr 19, 2020

@lacabra Do we need to add the CORS header on the server for this?

@lacabra
Copy link
Contributor

lacabra commented Apr 19, 2020

@assafmo CORS is set up here, and as per documentation, these are the defaults, which set origin="*" which should accept requests from any domain. If we modify this code, ping me, and I will push the changes to the server to reload the live instance.

I have tested it with curl and Javascript client code (for example here), and they work fine.

@assafmo
Copy link
Member

assafmo commented Apr 19, 2020

Cool, thanks. No plans to change the code for now.
@cmalfesi Sorry so I don't get it... Why and where you are seeing CORS errors?

@cmalfesi
Copy link
Contributor Author

cmalfesi commented Apr 19, 2020

@assafmo
AS I have shared on my video on this comment, when I try to use findMatch in the frontend, it returns CORS error.

This is called after upload my location file and try to show the results.
../UIcode/src/Pages/Results/index.jsx

Some days ago, we had the same problem with the endpoint addPersonalData, but it was solved changing the way to use async and await functions in React. I tried the same solution for findMatch, but I still have the same Cors error.

I will try to fix again on Monday.

@cmalfesi
Copy link
Contributor Author

cmalfesi commented Apr 21, 2020

@lacabra
I was trying to fix the CORS problem when I call the findMatch in the React frontend, but I couldn't get it working well.
I have tested your javascript script from ../client/index.js and it works good only with your example.
If I try to run it with the id user hash value it doesn't work well.

Here the example using the hash value created from the email users:
image

Error:
image

If I back the parameters to the original values, then it works again.

FYI: I'm using this enclave server for my tests
const JSON_RPC_Server='https://safetrace.enigma.co';

Can you tell me if I'm doing something wrong?

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