Skip to content

Error compiling schema. #923

@tlgimenes

Description

@tlgimenes

Describe the bug
When using typescript-sdk on restricted javascript execution environments we get the following error:
Image

This is because restricted javascript environments, like cloudflare workers or deno deploy do not accept eval, or new Function constructions. Since ajv.compile requires these dinamic evaluations, this error is logged to the console.

To Reproduce
Steps to reproduce the behavior:

  1. Run the server on restricted JS envs like cloudflare workers (wrangler to test it locally)
  2. Add tools and try to connect to the server. You'll see this error popup

Expected behavior
No error log to be logged to the console if these primitives are not available.

Additional context
Places that should be, somehow, guarded

const validate = ajv.compile(params.requestedSchema);

const validator = this._ajv.compile(tool.outputSchema);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions