Content-Length: 207715 | pFad | http://github.com/dysbulic/xml-to-ipld/issues/2

76 Ceramic initialization failing in production with "Cannot call a class as a function" · Issue #2 · dysbulic/xml-to-ipld · GitHub
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

Ceramic initialization failing in production with "Cannot call a class as a function" #2

Open
dysbulic opened this issue Apr 15, 2021 · 1 comment

Comments

@dysbulic
Copy link
Owner

Bug Description

When the button is clicked on https://dysbulic.github.io/xml-to-ipld/#/ceramic the application crashes with the following error:

Uncaught (in promise) Error: Failed to resolve did:3:kjzl6cwe1jw14936apxr6lxhewn3srcpxjwjtu777mkfio7718ue8alc7pfr717?version-id=0#pn1iiYhhzD3kUev: invalidDid, TypeError: Cannot call a class as a function
    at A.<anonymous> (index.ts:303)
    at c (runtime.js:63)

The value of DID before the error is:

Screenshot from 2021-04-14 01-49-05

This issue does not occur in development. In development, the value of DID at the same location is:

Screenshot from 2021-04-14 01-49-41

The code being run is:

  const connect = async () => {
    
    const ceramic = (
      new Ceramic('https://ceramic-clay.3boxlabs.com')
    )
    await ceramic.setDIDProvider(didProvider)
    setCeramic(ceramic)
  }

Then in @ceramicnetwork/http-client:

  async setDIDProvider(provider: DIDProvider): Promise<void> {
    this.context.provider = provider;
    this.context.did = new DID({ provider, resolver: this.context.resolver })
    if (!this.context.did.authenticated) {
      await this.context.did.authenticate()
    }
  }

It dies calling new DID().

To Reproduce

  1. Go to https://dysbulic.github.io/xml-to-ipld/#/ceramic.
  2. Click on the "Connect Your Wallet" button.
  3. View the error in the console.
  4. git clone https://github.com/dysbulic/xml-to-ipld.git
  5. cd xml-to-ipld && yarn && yarn start
  6. No error and the program completes satisfactorily.

Expected Behavior

I would like the behavior in production to be the same as development.

Ceramic Versions

  • @ceramicnetwork/3id-did-resolver@^1.1.1
  • @ceramicnetwork/common@^0.17.0
  • @ceramicnetwork/docid@^0.5.1
  • @ceramicnetwork/doctype-caip10-link@^0.13.4
  • @ceramicnetwork/doctype-tile@^0.14.1
  • @ceramicnetwork/http-client@^0.10.1
  • @ceramicstudio/idx@^0.7.0
  • @ceramicstudio/idx-tools@0.9.0

Machine, OS, Browser Information

  • Linux fenrir 5.8.0-48-generic #54~20.04.1-Ubuntu SMP Sat Mar 20 13:40:25 UTC 2021 x86_64 GNU/Linux
  • Browsers:
    • Chrome 89.0: Works in development, not in production.
    • Firefox 87.0: Works in development, not in production.
    • Opera: Crashes b/c accounts[0] is not defined.
    • Brave: Crashes b/c window.ethereum is not defined.

Additional Information

It looks to me like the minimizer made a mistake, but that just seems so unlikely.

@dysbulic
Copy link
Owner Author

A while ago I was trying to alter the system to have the capability to load components from arbitrary servers on the web to allow for a more robust plugin architecture.

I ejected the application and added Craco in an attempt to get it to generate standalone components.

I never got it to work and seem to have broken Webpack in the process.

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

No branches or pull requests

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/dysbulic/xml-to-ipld/issues/2

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy