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

[Regression, Breaking] CallBuilder pollute Server instance URI #379

Closed
MisterTicot opened this issue Jul 23, 2019 · 1 comment
Closed

[Regression, Breaking] CallBuilder pollute Server instance URI #379

MisterTicot opened this issue Jul 23, 2019 · 1 comment
Assignees
Labels

Comments

@MisterTicot
Copy link
Contributor

Describe the bug

Since 2.0.1, using a CallBuilder may pollute the issuing Server instance URI resulting in following CallBuilder instances trying to fetch the wrong URL.

To Reproduce

const StellarSdk = require("stellar-sdk")
const server = new StellarSdk.Server("https://horizon.stellar.org")
const account = "GDEDX3Z64XBZGQ72ZQNHAGDDBOVYNQ2KSVQ7ASO5NQDPHRVCX4BGISF6"

function debug () {
  // In 2.0.1, creating this call builder will pollute the server object URI.
  const offerCallBuilder = server.offers("accounts", account)
  console.log(server)
  // As a consequence, this second call builder will fail to fetch data.
  const effectCallBuilder = server.effects().forAccount(account).limit(1)
  effectCallBuilder.call().then(console.log).catch(console.error)
}

debug()

I advise to run this script with both 2.0.1 and a previous version for the purpose of comparing results.

Expected behavior

The Server instance should not get polluted and the second callBuilder call should properly fetch data.

Additional context

Update to StellarSDK 2.0.1 broke Equilibre.io portfolio history retrieval. In Equilibre.io, I re-use the same server object for all calls to Horizon in order to not spam memory with new instances.

@abuiles abuiles self-assigned this Jul 24, 2019
@abuiles
Copy link
Contributor

abuiles commented Jul 24, 2019

@MisterTicot thanks for the report, we are investigating.

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

No branches or pull requests

2 participants