bkyerv
Explore posts from serversCDCloudflare Developers
•Created by bkyerv on 4/17/2025 in #workers-help
help with astro app backend functions on cloudflare workers
I've created a minimal reproducible repo on GitHub for an Astro app deployed to Cloudflare Workers.
The app includes functionality to call a server-side function that should log messages, but I'm encountering issues:
No messages appear in the Cloudflare Workers logs section after deployment
No requests seem to be reaching the backend at all
The client-side requests to the backend function aren't being processed
https://github.com/bkyerv/astro-app/tree/main/src
4 replies
CDCloudflare Developers
•Created by bkyerv on 4/16/2025 in #workers-help
help with astro framework deployment to cloudflare workers
I'm deploying an Astro project to Cloudflare Workers following the static assets guide, but I'm stuck with API routing.
With React projects, Cloudflare creates separate src and worker folders, with backend code in the worker folder. However, my Astro project doesn't have a worker folder.
I tried manually creating a worker folder with code to handle API routes, but all fetch requests to /api/... return 404 errors, despite my worker code being set up to respond with test messages.
How do I correctly structure an Astro project for Cloudflare Workers to support both frontend pages and API routes? Is the setup different from React projects?
2 replies
BABetter Auth
•Created by bkyerv on 4/9/2025 in #help
typescript not recognizing role field in astro locals with better auth
added a role field via additionalFields in auth.ts. At runtime, isAuthed.user from auth.api.getSession correctly includes role, but TypeScript doesn’t recognize it on Astro.locals.user. My env.d.ts uses import("better-auth").User, which lacks custom fields. Tried inferAdditionalFields<typeof auth>() on the client, but it didn’t help Astro’s types. Any advice on aligning the types properly?
5 replies
BABetter Auth
•Created by bkyerv on 4/8/2025 in #help
what's the signature format for session cookies?
When examining a working session cookie created by Better Auth (__Secure-better-auth.session_token), I see it has a format like token.signature. What algorithm/process is used to create this signature? Is there a way to generate a valid cookie manually or is this only possible through Better Auth's internal APIs?
10 replies
BABetter Auth
•Created by bkyerv on 4/8/2025 in #help
how to integrate non-oauth providers?
I'm implementing Telegram login which doesn't follow OAuth flow. After verifying the user's Telegram credentials and creating/finding the user in my database, what's the correct way to create a proper Better Auth session? I want to avoid false negatives when checking sessions in my middleware.
5 replies
BABetter Auth
•Created by bkyerv on 4/7/2025 in #help
better-auth Session Not Recognized After Manual Creation in Telegram Callback
Telegram successfully authenticates, and my callback verifies the data. However, I'm manually creating the session record in the DB and setting the session cookie afterwards.
Below how I'm doing it in my /api/auth/callback/telegram.ts. After this manual setup and redirecting to a protected route, my middleware check await auth.api.getSession(...) fails to recognize the session, causing a redirect back to /signin.
My Question: Is manually inserting into the session table and setting the better-auth.session_token cookie like this the correct approach for integrating a custom callback (like Telegram's data-auth-url) with better-auth?
1 replies
CDCloudflare Developers
•Created by bkyerv on 3/15/2025 in #general-help
transfer domain between Cloudflare accounts
I need to move a domain from one Cloudflare account to another. The domain is already on Cloudflare—I just want to transfer it to a different Cloudflare account. What’s the best way to do this?
3 replies
BABetter Auth
•Created by bkyerv on 2/14/2025 in #help
TypeScript Error: ActionArgs not assignable to Request in better-auth handler
Following the docs at https://www.better-auth.com/docs/integrations/remix for setting up the API route handler, but getting a TypeScript error when passing the request object.
Error:
1 replies
BABetter Auth
•Created by bkyerv on 2/14/2025 in #help
Google Sign-In Not Working with `authClient.signIn.social()`
I'm implementing Google authentication using better-auth with React. Here's my setup:
1. Client-side auth client:
2. Server-side auth configuration:
3. Sign-in component:
Issue:
When I click the sign-in button, nothing seems to happen. I've configured my Google OAuth credentials and environment variables, but the authentication flow isn't starting.
Questions:
Am I missing any configuration steps?
Is there a way to debug the authentication flow?
Should I be handling the response from authClient.signIn.social() differently?
Environment:
better-auth (latest version)
React
TypeScript
React Router
6 replies
CDCloudflare Developers
•Created by bkyerv on 2/13/2025 in #workers-help
Best practices for customizing Worker entry point in Astro + Cloudflare Workers static assets setup
I'm working on an Astro project with Cloudflare Workers (static assets) integration, and I need to access Worker bindings (D1 database) in my API endpoints. Currently, my wrangler.json has "main": "./dist/_worker.js/index.js" which seems to be set up by Astro.
I want to add custom Worker logic to handle API routes and access D1, but I'm unsure about the best/safest way to do this without breaking Astro's existing Worker setup. I see a few possible approaches:
- Modify the main entry point in wrangler.json (but this seems risky)
- Use Astro's middleware system somehow
- Something else?
My current wrangler.json:
What's the recommended way to add custom Worker logic while maintaining Astro's existing Worker setup? Any help would be appreciated! 🙏
2 replies
CDCloudflare Developers
•Created by bkyerv on 1/13/2025 in #workers-help
deploying existing astro app using workers
is it possible to deploy an existing astro framework app using cloudflare workers for static assets? or does deploying with workers require the project to be initiated using npm run cloudflare@latest? i’m trying to understand if i can adapt an already built app for this setup. thanks!
4 replies
CDCloudflare Developers
•Created by bkyerv on 1/11/2025 in #workers-help
Cloudflare Worker + Astro Deployment Issue
Running into an issue with deploying static assets in my Cloudflare Worker project using Astro. The deployment command (npm run deploy) that was working fine yesterday is now throwing this error:
Seems like there might be a dependency conflict with ESM/CommonJS modules. Has anyone run into this recently or knows a workaround? Any help appreciated!
6 replies
CDCloudflare Developers
•Created by bkyerv on 1/10/2025 in #workers-help
React SSR on Cloudflare Workers fails due to missing MessageChannel API
Ran into an interesting issue deploying an Astro site using workers (not pages. instead serving static assets using worker): The React renderer fails with MessageChannel is not defined error when trying to do server-side rendering in Workers.
Has anyone found a clean workaround for this?
3 replies
CDCloudflare Developers
•Created by bkyerv on 10/30/2024 in #workers-help
Cloudflare Workflows Binding Error in Astro Project

5 replies
CDCloudflare Developers
•Created by bkyerv on 10/30/2024 in #workers-help
Integrating Cloudflare Workflows with Astro
I'm trying to integrate the newly announced Cloudflare Workflows with an existing Astro project (not using the starter template) and running into some TypeScript issues.
Issue 1: Module Resolution
Getting error on import:
Issue 2: Type Arguments
Example from docs throwing TS error:
Current setup
Questions:
What's the correct way to set up Workflows in an existing Astro project?
What should the folder structure look like?
Are there any specific configuration steps needed for TypeScript to recognize the cloudflare:workers module?
How do we properly type the json<T>() response?
Any help or guidance would be greatly appreciated! 🙏
1 replies
CDCloudflare Developers
•Created by bkyerv on 10/16/2024 in #pages-help
Need Help with Astro + Cloudflare + Turso DB Setup
Hey everyone, I’m running into an issue with my Astro app. Locally, everything works fine, but in production on Cloudflare, I’m getting a 401 Unauthorized error when trying to insert data into the database (db.insert(Waitlist_signups)). I’m using Turso for the database as per the documentation and have added the necessary environment variables (both the DB token and URL) in Cloudflare, but still facing this issue.
Has anyone encountered something similar or know what could be causing the 401 error?
Thanks in advance for any help!
4 replies
CDCloudflare Developers
•Created by bkyerv on 10/15/2024 in #pages-help
Issue with Remix App Deployment on Cloudflare Pages - 404 Error After Successful Deploy
I’m having trouble deploying a simple Remix app. I created the app by running npm run remix@latest, pushed the local repo to GitHub, and connected it to Cloudflare Pages. I set up the deployment and picked the correct repo. The deployment is successful, but when I click the link, I’m getting a 404 error instead of the page being rendered. I followed the Pages documentation and pointed to the correct build/client folder. Any ideas on what could be wrong?
5 replies
CDCloudflare Developers
•Created by bkyerv on 9/30/2024 in #general-help
Locating Worker file in static assets (Astro) server from worker
I'm working on a project using Astro as a framework for a Cloudflare Worker, but I'm a bit lost in the project structure. I used the npm create cloudflare@latest command to set up the project, which gave me what looks like a standard Astro project.
My main questions are:
- Where should I place the Worker code? Or has it already been set up by the Cloudflare package?
- In general, where can I find the Worker-specific parts of this project?
If anyone has experience with this setup, I'd really appreciate some guidance on navigating the project structure and identifying where these Cloudflare Worker elements fit in. Thanks in advance for any help!
2 replies
CDCloudflare Developers
•Created by bkyerv on 9/11/2024 in #general-help
Cloudflared setup: Empty config.yml file - Manual creation or automatic generation?
Hey everyone, I'm trying to set up cloudflared but I'm hitting a snag. I'm getting an error saying my config file at /Users/by/.cloudflared/config.yml is empty. I'm not sure if I need to create this file manually or if there's a command that should generate it automatically. Has anyone dealt with this before? Any tips on how to properly populate the config file? Thanks in advance!
5 replies