#"@stellar/stellar-sdk": "^11.2.1" - source not specified

1 messages · Page 1 of 1 (latest)

empty warren
#

Hi, getting this weird error after upgrading from stellar-sdk to @stellar/stellar-sdk. Where our payment operations throws: TypeError: XDR Read Error: source not specified

I've commented a sample code here: https://gist.github.com/Shaptic/5ce4f16d9cce7118f391fbde398c2f30

As stated, this have been working fine for years, also just tried on a fresh NodeJS app.

Gist

A migration guide for [email protected]. GitHub Gist: instantly share code, notes, and snippets.

empty warren
#

@here

copper slate
#

what version did you upgrade from? I've seen this error when people use it in environments that has weird support for Buffer, because we don't polyfill it as robustly anymore as of v11. also in environments that mix stellar-base and stellar-sdk usage, which is explicitly advised against.

empty warren
#

We came from v10, hmm, so you think it could have something todo with Buffer ?

also in environments that mix stellar-base and stellar-sdk usage, which is explicitly advised against.
Yeah, we're only running @stellar/stellar-sdk now as a test, and thats where the issue arises. We are using RN and the JS lib. As stated, this code was working fine in RN prior to the v11 upgrade (that includes "hacking" the installation with cryptojs etc)

So the envorment was/is/should be correct, code runs fine when downgrading to v10 again

copper slate
#

ah yes RN is one of those problematic ones. one solution I've seen was using a different JS compiler, specifically V8 on Android + JSC on iOS

#

iirc the root cause was the other compilers doing really, really weird stuff w/ buffer and uint8array that the lib can't handle anymore because of how webpack 5 does polyfills

empty warren
#

Thanks for the info @copper slate Not surprised that RN is the problem child hehe. Do you have any resources you could link me? Or do you know which compiler they had success with?

copper slate
#

@empty warren they confirmed that it worked with V8 on Android and JSC on iOS :) I can dig up the details if that immediate solution isn't enough; it was a loooong thread

empty warren
#

This is great @copper slate 🙂 Just ran a test locally and it seems that disabling hermes, and only running JSC (JavaScriptCore) seems to fix the polyfill issue. Will test on Android as well ofc.

On another note: The @stellar/stellar-sdk is throwing the following warnings:

 WARN  The provided value 'ms-stream' is not a valid 'responseType'.
 WARN  The provided value 'moz-chunked-arraybuffer' is not a valid 'responseType'.

That does not impact anything btw

Edit: Using V8 runtime for Android solved it as well.

empty warren
copper slate
#

woo, awesome, thank you for the update and the comment!