Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

[governance-sdk] TypeError: (0 , superstruct_1.instance) is not a function #538

Open
jessupjn opened this issue Apr 11, 2022 · 5 comments
Open

Comments

@jessupjn
Copy link

jessupjn commented Apr 11, 2022

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

@jessupjn
Copy link
Author

jessupjn commented Apr 12, 2022

Seems to be an issue in webpack - and is reproducible using the wallet-adapter starter repos:

  1. I forked the repo under jessupjn/wallet-adapter
  2. Added @solana/spl-governance dep to package/starter/create-react-app-starter and printed from it.
  3. 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)

@SebastianBor
Copy link
Contributor

@0xodia
Copy link

0xodia commented Apr 19, 2022

Hey @SebastianBor. I am not in the discord directed by that link. Could you copy and paste the workaround for this issue?

@badass-commits
Copy link

@SebastianBor Unable to load discord convo. Could you please write workaround here?

@SebastianBor
Copy link
Contributor

image

arielsegura added a commit to nation-io/solana-dao-sdk that referenced this issue Oct 5, 2022
setting GENERATE_SOURCEMAP=false due to facebook/create-react-app#11752

also using react-app-rewired due to facebook/create-react-app#12021 and solana-labs/oyster#538
arielsegura added a commit to nation-io/solana-dao-sdk that referenced this issue Oct 6, 2022
* use spl-governance serializers

* fix demo app

setting GENERATE_SOURCEMAP=false due to facebook/create-react-app#11752

also using react-app-rewired due to facebook/create-react-app#12021 and solana-labs/oyster#538
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants