-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Astro DB on Cloudflare: Build fails with "Cannot create a remote client: missing app token" error. #10872
Comments
We had some downtime earlier today. Can you confirm that you're still experiencing this? |
@matthewp still seeing both the errors.
|
@pMay2021 are you providing the environment variable |
Locally they would not need the token, it gets retrieved as long as they are logged in. @pMay2021 Can you try logging in again locally? I doubt that's the problem but would help to isolate. |
Hi @matthewp what do you mean "login locally"? There's no issue on my local machine. But unfortunately this morning I'm hitting the
Stackblitz reproduction I'm unable to reproduce on Stackblitz. Astro DB doesn't install. I get an error saying
and when I tried to install manually, I get:
here's the link to a very basic project: https://stackblitz.com/edit/github-wdwm38?file=astro.config.mjs (it won't built and fails with an error) I have a question - how do I make the remote database connection work from Stackblitz? I've created a temp token on Studio, do I give it to you to paste it in a .env? (PS - I apologize if I'm missing something basic. I'm new to a lot of this--but I love Astro though!). |
I have the same problem as @pMay2021, not any problems locally but when trying to deploy, I get this error at the last step:
I have to point out, I don't have the problem in a previews commit which connects to the DB but no Insert to the DB. The latest commit does DB Insert too. |
@alirexa are you also using Cloudflare? |
They do, looking at their |
@alirexa Did you set the |
I'm experiencing the same issue. After playing around with this for a little while I found the issue in my case is using Not sure if I should comment here, or create a new issue, so I'll start here. Astro InfoAstro v4.9.2 Link to reproducible buildhttps://github.com/aurelius-coffee/my-astro-app/tree/main I tried stackblitz, but couldn't log into astro studio there. |
Very interesting, we'll check that out. |
If this was turso I think we could create the import { defineMiddleware } from "astro:middleware";
import { drizzle } from "drizzle-orm/libsql";
import { createClient } from "@libsql/client/web";
import { comments } from '../lib/schema'
// `context` and `next` are automatically typed
export const onRequest = defineMiddleware(async (context, next) => {
const turso = createClient({
url: context.locals.runtime.env.TURSO_DATABASE_URL!,
authToken: context.locals.runtime.env.TURSO_AUTH_TOKEN,
});
const db = drizzle(turso);
const result = await db.select().from(comments).all();
console.log('result is', result)
return next()
}); |
new edit: I can now confirm that if I remove the dependency on Astro DB from middleware, Cloudflare builds and works. Ok, I'm back after a while. I gave up trying to get it running on CF and focused on getting my features done on the local env, and everything works fine, as in my local instance connects perfectly to the remote Astro DB. Finally, this morning I tried to deploy on Cloudflare, and it failed in the last step, with the same error as @alirexa Note: I have configured
Usage of db in middlewareWhile I don't import "astro:db" in my middleware, I do call a library function that imports "astro:db". I cannot easily remove the db dependency without breaking a lot of pages. I can now confirm that if I remove the dependency on Astro DB from middleware, Cloudflare builds and works. An oddity I noticedI did notice an oddity on Astro Studio though, not that it matters, but here's what I saw. For example, when I generate a token, I see something like this on the screen:
but if I use the copy to clipboard, it actually gives me
not sure if that matters. Astro infoAstro v4.9.2 SummaryHopefully, it's now helpful from two examples that the Cloudflare build fails when there's Astro DB dependency in the middleware and this blocker can be resolved. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
My Cloudflare account deploys automatically on GitHub checkin.
Astro DB works fine local and with --remote (though I've been seeing some ENETUNREACH today but let's park that).
Deployment on Cloudflare fails with the following error:
ASTRO_STUDIO_APP_TOKEN
= value, is set on Cloudflare settings.My configuration is this:
Not sure what else to do.
What's the expected result?
Build to complete and deploy.
Link to Minimal Reproducible Example
It's on my CF deployment.
Participation
The text was updated successfully, but these errors were encountered: