BotID with Sveltekit

I’m reading the announcement of BotID with interest :tada:

Is there any guide about integrating BotID with Sveltekit?

Or is the 'botid/client'; ready to be consumed in a svelte project direclty?

Thanks

2 Likes

Hi @alexbjorlig, glad that you found this release interesting.

From the docs, I think it is supported because we do mention adding redirects for other frameworks but I even there I don’t see suggestions for Client side logic in Svelte.

I’ve asked the team to share more details.

1 Like

Hi @alexbjorlig , I built BotID! I’m currently working with Elliott from the Svelte community on getting BotID working in Svelte :slight_smile: stay tuned!

6 Likes

Hello, any update on getting this to work for svelte?

3 Likes

Hey @northfacejmb , great timing!

1 Like

update @alexbjorlig

3 Likes

Hi @quuu - thanks for the link.

Reading through the documentation, is this part correct instructions for Sveltekit?

When using the vercel adapter, I was under the impression that we can’t add rewrites/headers to the vercel.json, but I could be mistaken?

1 Like

It’s possible to use vercel.json with sveltekit: SvelteKit on Vercel

It’s not recommended for the reason mentioned, but the purpose of these rewrites for botID is to proxy the botID challenge endpoints to not get blocked by adblockers and other programs,

So vercel.json works great with sveltekit for it :slight_smile:

1 Like

Ok great - will be looking forward to give it a spin.

What aobut this part?

Does it also support routes with params?

It does - specifically it only supports wildcards, check out the nextjs client side config for details on the wildcard usage :smiley:

1 Like

Hi @quuu.

We can’t get anything to work with BotID currently in our Sveltekit app.

Can you share some details as to review apps? The documentation mentions that the rewrites only works in production, but what about review apps then?

How does BotID detects when it’s production/review app/ local development?

Thanks

it works on preview! it works on anywhere vercel.json works - which is any environment deployed on vercel

local dev is determined by process.env.NODE_ENV === 'production' for local development, everywhere else it is treated as normal botID

Hmm ok.

We can’nt get it to work on Vercel review apps, we are always detected as a bot.

The review app is running https://web-i9ak5nb4x-21-risk.vercel.app/test-route

I just opened a support case with Vercel, because we can’t view the config.json under “Source/.vercel/output/config.json”…

I just got this error in the console:

Could this be a CSP issue?

2 Likes

No this is a limitation with BotID on frameworks that don’t natively support redirects and rewrites

Feel free to book a time here and let’s sort this out: Notion Calendar

Thanks for offering a calendar link, but one of our engineers is trying to setup a minimal reproduction (and currently it works there).

So we will see if we can reproduce, and then get back to you :smiling_face_with_sunglasses:

1 Like

So in the end, it was solved related to this issue when building Sveltekit and deplyoing with Vercel CLI prebuilt.

@quuu Quick feedback, from a Svetlekit persepctive it would be great if the initBodId could use the Svetlekit routeIds - read more here.

This would add typescript protection of the route configuration.

1 Like

Glad it worked in the end! thanks for linking the sveltekit issue, makes sense, h/t to Elliott :smiley:

For sure will look into supporting SvelteKit routeIds, let me know if there’s any other issues with botid!

1 Like