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

Bug: Instantiating Surreal causes "node:crypto" error #54

Open
2 tasks done
var-che opened this issue Feb 26, 2024 · 1 comment
Open
2 tasks done

Bug: Instantiating Surreal causes "node:crypto" error #54

var-che opened this issue Feb 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@var-che
Copy link

var-che commented Feb 26, 2024

Describe the bug

Instantiating Surreal wasm within the Reactjs part of the Nextjs project causes an error:

Module build failed: UnhandledSchemeError: Reading from "node:crypto" is not handled by plugins (Unhandled scheme).

Steps to reproduce

Create a NextJs app and instantiate the Surreal database within the page.tsx.

"use client"
import {Surreal} from 'surrealdb.wasm';
export default function NameDoesntMatter() {
  prepareSurreal();
  return(<p>demo</p>);
}

async function prepareSurreal() {
  let db  = new Surreal();
  try {
    await db.connect('memory');
    await db.use({database: "db", namespace: "ns"});
  } catch (error) {
    console.log(error)
  }
}

Expected behaviour

I expect it to instantiate the database so that I can use in-memory one, on the browser.

I expect to be able to create a new user and query that user back.

SurrealDB version

surrealdb wasm 0.8.0 ubuntu 22.04.3 LST

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@var-che var-che added the bug Something isn't working label Feb 26, 2024
@var-che var-che changed the title Bug: Bug: Instantiating Surreal causes "node:crypto" error Feb 27, 2024
@dodikuswono
Copy link

any workarround for this problem ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants