How do you query OSDK from a Workshop Widget?

Hi, I’m developing an embedded custom widget for Workshop. I want to query OSDK in the widget, but my requests to loadObjects (via the generated client ) are all failing with an error:

{"errorCode":"INVALID_ARGUMENT","errorName":"Api:InvalidFieldType","errorInstanceId":"83cb116f-05c6-4864-8fa1-af77df3561f7","parameters":{"columnNumber":"0","expectedType":"LoadObjectSetRequestV2","lineNumber":"1"}}

This error doesn’t really leave me much to go on, and I think my request is well formatted - in my browser I see it is:

{"objectSet":{"type":"filter","objectSet":{"type":"base","objectType":"MyObject"},"where":{"type":"eq","field":"myObjectId","value":"123"}},"select":[],"excludeRid":true,"snapshot":false,"pageSize":1}

The path the request was made on is api/v2/ontologies/ri.ontology.main.ontology.<My ontology>/objectSets/loadObjects.

My code is almost exactly the sample code I was given when I made the widget

in client.ts

import { $ontologyRid } from "@custom-widget/sdk";
import { createClient } from "@osdk/client";

export const client = createClient(
  window.location.origin,
  $ontologyRid,
  () => Promise.resolve("widgets-auth"),
);

in my Widget.tsx:

import React, { useCallback, useEffect, useState } from "react";
import { useWidgetContext } from "./context";
import { client } from "./client";
import { MyObject } from "@custom-widget/sdk";
import type { Osdk } from "@osdk/client";
import { Spinner } from "@radix-ui/themes";

export const Widget: React.FC = () => {
  const { parameters } = useWidgetContext();
  const { myId } = parameters.values;

  const loadData = useCallback(async () => {
    const c = await client(MyObject)
      .where({myObjectId: {$eq: myId}})
      .fetchPageWithErrors({$pageSize: 9000, $orderBy: {"myObjectId": "asc"}});
    console.log(c);
  }, [myId])

  useEffect(() => {
    loadData();
  }, [loadData]);

  return (
    <div>
      {isLoading && <Spinner/>}
    </div>
  );
};

Any ideas why I can’t load this object in the dev browser when working on my custom widget? I don’t understand why the request is failing with a 400 error - am I using the library that was pregenerated incorrectly?