Xano JS SDK - Can't instantiate XanoClient with XanoSessionStorage

Options

Hello guys, I'm trying to set the Xano SDK up to use session storage but I keep getting this error: ReferenceError: Can't find variable: XanoSessionStorage

Here's my setup

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@xano/js-sdk@latest/dist/xano.min.js"></script>

<script>

const xano = new XanoClient({

'apiGroupBaseUrl': 'my endpoint url',

'storage': new XanoSessionStorage()

});

// rest of the code...

</script>

Is this a bug with the SDK or am I doing anything wrong here? Appreciate your advice & help please. Thanks!

Tagged:

Answers

  • dorilama
    dorilama Member
    Options

    It looks like the pre-bundled JS bundle library is missing that class.

    Scrolling through the code of the repo on gitlab it looks like it actually exports only XanoClient

    If you use a workflow with building tools then you can import everything like in the example and it should work.

  • Bootstrapper
    Options

    Thanks @dorilama! I'm using Webflow hence using the CDN. Building tools isn't an option for me at the moment.

    However I'm curious - isn't the building tools pulling the exact same thing from the same repo? If the XanoSessionStorage is missing there then using building tools should also return the same issue.

    @Michael Udinski - wondering if it is indeed a bug?

  • dorilama
    dorilama Member
    Options

    isn't the building tools pulling the exact same thing from the same repo?

    Not necessarely