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: Top Level await issue #5

Open
2 tasks done
SOG-web opened this issue Nov 28, 2024 · 3 comments
Open
2 tasks done

Bug: Top Level await issue #5

SOG-web opened this issue Nov 28, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@SOG-web
Copy link

SOG-web commented Nov 28, 2024

Describe the bug

Am using Node 22.5.1

✘ [ERROR] Top-level await is not available in the configured target environment ("chrome130.0", "edge130.0", "firefox115.0", "ios17.0", "safari17.0" + 7 overrides)

node_modules/.pnpm/@surrealdb+ql-wasm@0.2.0-beta.9/node_modules/@surrealdb/ql-wasm/dist/surrealql/index.js:26:15:
  26 │     readFile: (await import("node:fs")).readFileSync
     ╵                ~~~~~

✘ [ERROR] Top-level await is not available in the configured target environment ("chrome130.0", "edge130.0", "firefox115.0", "ios17.0", "safari17.0" + 7 overrides)

node_modules/.pnpm/@surrealdb+ql-wasm@0.2.0-beta.9/node_modules/@surrealdb/ql-wasm/dist/surrealql/index.js:28:11:
  28 │   module = await (async () => {
     ╵            ~~~~~

✘ [ERROR] Top-level await is not available in the configured target environment ("chrome130.0", "edge130.0", "firefox115.0", "ios17.0", "safari17.0" + 7 overrides)

node_modules/.pnpm/@surrealdb+ql-wasm@0.2.0-beta.9/node_modules/@surrealdb/ql-wasm/dist/surrealql/index.js:897:15:
  897 │     wasmCode = await Deno.readFile(wasm_url);
      ╵                ~~~~~

✘ [ERROR] Top-level await is not available in the configured target environment ("chrome130.0", "edge130.0", "firefox115.0", "ios17.0", "safari17.0" + 7 overrides)

node_modules/.pnpm/@surrealdb+ql-wasm@0.2.0-beta.9/node_modules/@surrealdb/ql-wasm/dist/surrealql/index.js:902:15:
  902 │     wasmCode = await (await fetch(wasm_url)).arrayBuffer();
      ╵                ~~~~~

✘ [ERROR] Top-level await is not available in the configured target environment ("chrome130.0", "edge130.0", "firefox115.0", "ios17.0", "safari17.0" + 7 overrides)

node_modules/.pnpm/@surrealdb+ql-wasm@0.2.0-beta.9/node_modules/@surrealdb/ql-wasm/dist/surrealql/index.js:902:22:
  902 │     wasmCode = await (await fetch(wasm_url)).arrayBuffer();
      ╵                       ~~~~~

✘ [ERROR] Top-level await is not available in the configured target environment ("chrome130.0", "edge130.0", "firefox115.0", "ios17.0", "safari17.0" + 7 overrides)

node_modules/.pnpm/@surrealdb+ql-wasm@0.2.0-beta.9/node_modules/@surrealdb/ql-wasm/dist/surrealql/index.js:907:20:
  907 │ var wasmInstance = (await WebAssembly.instantiate(wasmCode, imports)).instance,
      ╵                     ~~~~~

Steps to reproduce

Just install fresh angular app the try use this package

Expected behaviour

To validate the surrealql

SurrealDB version

latest

Contact Details

raheemolaleknusman84@gmail.com

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
@SOG-web SOG-web added the bug Something isn't working label Nov 28, 2024
@SOG-web
Copy link
Author

SOG-web commented Nov 28, 2024

version: "@surrealdb/ql-wasm": "0.2.0-beta.9", or "@surrealdb/ql-wasm": "0.2.0-beta.1",

@SOG-web
Copy link
Author

SOG-web commented Nov 28, 2024

this is what causing error,

import { SurrealQL, Value } from "@surrealdb/ql-wasm";
const parsed = decodeCbor(Value.from_string(paramString).to_cbor().buffer);

export function validateThing(thing: string): string | undefined {
	try {
		SurrealQL.validate_thing(thing);
		return undefined;
	} catch (err: any) {
		return err;
	}
}

@SOG-web
Copy link
Author

SOG-web commented Dec 9, 2024

hello

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

1 participant