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

Client#getHttpUrl misbehaving? #294

Open
hydrozoa-yt opened this issue Feb 7, 2022 · 1 comment
Open

Client#getHttpUrl misbehaving? #294

hydrozoa-yt opened this issue Feb 7, 2022 · 1 comment
Labels
bug Something isn't working Team Lamprey

Comments

@hydrozoa-yt
Copy link

hydrozoa-yt commented Feb 7, 2022

Subject of the issue

I'm making a simple transactions lookup with the v2 indexer, via algoexplorer's access point. In the example code, the request url is printed, and it works fine in the browser.
However, the request always 404's when made through the sdk.

Your environment

OpenJDK 17.0.2

Steps to reproduce

import com.algorand.algosdk.crypto.Address;
import com.algorand.algosdk.v2.client.common.IndexerClient;
import com.algorand.algosdk.v2.client.common.Response;
import com.algorand.algosdk.v2.client.indexer.LookupAccountTransactions;
import com.algorand.algosdk.v2.client.model.Transaction;
import com.algorand.algosdk.v2.client.model.TransactionsResponse;
 
public class Main {
 
    public static void main(String[] args) throws Exception {
        String host = "https://algoindexer.algoexplorerapi.io/";
        int port = 443;
 
        IndexerClient indx = new IndexerClient(host, port, "");
 
        Address one = new Address("KX6S647W6BEN6XHEJVMXK3UYLVNGT2Q6PHQSF5AA2JSSDFSOX7R4MESXRY");
 
        LookupAccountTransactions lookup = indx.lookupAccountTransactions(one).limit(10l);
        System.out.println(lookup.getRequestUrl());
        Response<TransactionsResponse> resp = lookup.execute();
        if (!resp.isSuccessful()) {
            System.out.println("Response code: "+resp.code()+" "+resp.message());
            return;
        }

        for (Transaction t : resp.body().transactions) {
            System.out.println(t.id);
        }
    }
}

Expected behaviour

The program should print the same json as the browser, when accessing the printed request url

Actual behaviour

The program always prints response code 404, even though the printed request url works in the browser.

Example output:

https://algoindexer.algoexplorerapi.io/v2/accounts/KX6S647W6BEN6XHEJVMXK3UYLVNGT2Q6PHQSF5AA2JSSDFSOX7R4MESXRY/transactions?limit=10
Response code: 404 {"message":"Not Found"}


Process finished with exit code 0

Also, when debugging it is revealed that Client#getHttpUrl constructs a url that repeats itself, see attached image

algosdk-bug

@hydrozoa-yt hydrozoa-yt added the new-bug Bug report that needs triage label Feb 7, 2022
@algoanne algoanne added bug Something isn't working and removed new-bug Bug report that needs triage labels May 8, 2023
@winder
Copy link
Contributor

winder commented May 23, 2023

We should have reviewed and merged in the PR: https://github.com/algorand/java-algorand-sdk/pull/304/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Team Lamprey
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants