solana-labs / solana-program-library

A collection of Solana programs maintained by Solana Labs
https://solanalabs.com
Apache License 2.0
3.5k stars 2.04k forks source link

safari @solana/spl-token, getAssociatedTokenAddress error #7312

Open rixhy-cyd opened 1 week ago

rixhy-cyd commented 1 week ago

Importing getAssociatedTokenAddress from @solana/spl-token is causing

'Unhandled JS Exception: Invalid regular expression: invalid group specifier name

Which basically is @solana/spl-token is using some lookbehind assertion RegEx, which is supported only from IOS 16.4 the versions before those are not supporting the causing error

Is there any workaround for this

For context: Was trying to use this library in a react native application where OS version below 16.4 causes me error

joncinque commented 7 hours ago

Ah darn, this might be similar to https://github.com/solana-labs/solana-web3.js/pull/2785 / https://github.com/solana-labs/solana-web3.js/pull/2745.

Looking through the code in the token JS library, I can't find any instances of regexes though. Do you have a full stack trace of the error? Maybe it's being thrown from a dependency, and we need to upgrade it

rixhy-cyd commented 5 hours ago

Hey Jon C,

Thanks for looking into this, I don't have a stack trace for it, let me try to debug more, am using your library in a react native app where having the import getOrCreateAssociatedTokenAccount from @solana/spl-token was causing me the issue, where my app crashes without any data.