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

error 502 and CORS #27

Closed
nad010286 opened this issue Jun 18, 2019 · 1 comment
Closed

error 502 and CORS #27

nad010286 opened this issue Jun 18, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@nad010286
Copy link

nad010286 commented Jun 18, 2019

I create some listeners to handle event emitted from Smart Contract and error happens:
Access to XMLHttpRequest at 'https://api.trongrid.io/event/contract/TGRcjrgNX2w3yJ8HZkGVEZAxza7fJSTSXB/LoseBet/latest?size=20&page=1&since=1560624083457&fromTimestamp=1560624083457&sort=block_timestamp' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

https://api.trongrid.io/event/contract/TGRcjrgNX2w3yJ8HZkGVEZAxza7fJSTSXB/LoseBet/latest?size=20&page=1&since=1560624083457&fromTimestamp=1560624083457&sort=block_timestamp
Return empty Array

But when I manually change to
https://api.trongrid.io/event/contract/TGRcjrgNX2w3yJ8HZkGVEZAxza7fJSTSXB/LoseBet/?fromTimestamp=1560624083457&sort=block_timestamp
it returns data

You can check because this is on MAINNET. Thanks

@sullof
Copy link
Contributor

sullof commented Jul 16, 2019

I don't know why the CORS issues happens, but the CORS configuration is definitely correct (otherwise nobody would be able to use TronGrid from any dApp).

About your empty result example, you are putting together parameters that are not compatible. Specifically, latest is not recognized in that format.

Anyway, I think that there is a bug. Because using the v1 format:
https://api.trongrid.io/v1/contracts/TGRcjrgNX2w3yJ8HZkGVEZAxza7fJSTSXB/events?event_name=LoseBet&block_number=10564249
should return data.

I will try to fix it. Thanks

@sullof sullof added the bug Something isn't working label Jul 16, 2019
@sullof sullof closed this as completed Sep 12, 2019
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

2 participants