oyster
oyster copied to clipboard
[governance-sdk] TypeError: (0 , superstruct_1.instance) is not a function
Our sdk relies on getGovernance
from @solana/spl-governance
. When the sdk is imported into our react project I am seeing an error thrown in console:
[bpfUpgradeableLoader.ts:12] Uncaught TypeError: (0 , superstruct_3.instance) is not a function
at Object.../switchboardv2-api/node_modules/@solana/spl-governance/lib/tools/sdk/bpfUpgradeableLoader.js (bpfUpgradeableLoader.ts:12:1)
at Object.options.factory (react refresh:6:1)
at __webpack_require__ (bootstrap:24:1)
at fn (hot module replacement:61:1)
at Object.../switchboardv2-api/node_modules/@solana/spl-governance/lib/governance/version.js (version.ts:10:1)
at Object.options.factory (react refresh:6:1)
at __webpack_require__ (bootstrap:24:1)
at fn (hot module replacement:61:1)
at Object.../switchboardv2-api/node_modules/@solana/spl-governance/lib/governance/index.js (index.ts:11:1)
at Object.options.factory (react refresh:6:1)
which corresponds to the PublicKeyFromString
export from bpfUpgradeableLoader.ts:
export const PublicKeyFromString = coerce(
instance(PublicKey),
string(),
value => new PublicKey(value),
);
Wanted to call this out and see if there was something that I may have missed
Seems to be an issue in webpack - and is reproducible using the wallet-adapter
starter repos:
- I forked the repo under jessupjn/wallet-adapter
- Added
@solana/spl-governance
dep topackage/starter/create-react-app-starter
and printed from it. - UI breaks with the same error shown above.
(Note that this is not reproducible when the same modifications are made to packages/starter/material-ui-starter
)
See the workaround https://discord.com/channels/910194960941338677/910566058740568094/959827068252741702
It depends on https://github.com/facebook/create-react-app/pull/12021
Hey @SebastianBor. I am not in the discord directed by that link. Could you copy and paste the workaround for this issue?
@SebastianBor Unable to load discord convo. Could you please write workaround here?
