Svelte Todo demo Error: crypto.randomUUID is not a function

Hi,

I followed the basic todo/tasks example for svelte to get something simple working before I dive in deeper. I can add records manually in the backend to my task table and they are listed in my browser from using the thin-backend query. But when I try to create a new task via the popup box I get the error below. Tables users and tasks have user_id fields
Another off topic question is how would I do the equivalent of an SQL join? I don’t see such info in the database docs section.

Suggestions?

Thanks

 hdatasync.js:507 Uncaught (in promise) Error: crypto.randomUUID is not a function while calling:

createRecord("tasks", {
    "title": "new",
    "userId": "37bd2111-0f3b-441a-b721-4e8099da09ea"
})
    at createRecord (datasync.js:507:15)
    at HTMLButtonElement.addTask (Tasks.svelte:7:9)
createRecord @ datasync.js:507
addTask @ Tasks.svelte:7ere

Can you share what browser and browser version you’re using? crypo.randomUUID is used by Thin to generate a UUID for the id column. It should be supported in all modern browsers.

Joins are not supported yet, but will be in the future! In the meantime you need to manually query things, e.g. to get all posts with comments you can do this:

const posts = useQuery(query('posts'));
const postIds = posts?.map(post => post.id)
const comments = useQuery(query('comments').whereIn('postId', postIds))

Hi, Thanks for the reply. I’m using latest Brave/Chrome on Manjaro Linux.
Version 1.45.118 Chromium: 107.0.5304.91 (Official Build) (64-bit)
Manjaro Firefox 106.0.4 (64-bit)

The problem still does appear for me in your Svelte Guide after logging in and trying to add an item to the todo list. I’m trying to figure it out still.

Ideally a SvelteKit guide would help a lot. That is what I’m developing on. But for now I’m just trying to get thin.dev working on plain Svelte.

Xenfasa

I’ve just tried to reproduce this with a new svelte project and the latest brave browser. For me adding a task works without any error.

Could you maybe send me a zip file of your project or send the github link? Maybe there’s something else wrong.