lettucebaran
lettucebaran
Explore posts from servers
CDCloudflare Developers
Created by lettucebaran on 7/21/2024 in #pages-help
An unknown error occured. Contact your account team or Cloudflare support: https://cfl.re/3WgEyrH.
Background I made changes to my Next.js project. I found out which lines cause the script to throw an error, but I don't understand why. So, I am blind trying to navigate on an unknown path. My deployment command is:
pnpm next-on-pages && pnpm wrangler pages deploy
pnpm next-on-pages && pnpm wrangler pages deploy
Problem The error I receive after trying running the deployment command:
✨ Compiled Worker successfully
✨ Uploading Worker bundle
✨ Uploading _routes.json
80
✘ [ERROR] A request to the Cloudflare API (/accounts/10588302399247a4add0cce49f3d28ee/pages/projects/e303-dk/deployments) failed.

An unknown error occured. Contact your account team or Cloudflare
support: https://cfl.re/3WgEyrH. [code: 8000000]
✨ Compiled Worker successfully
✨ Uploading Worker bundle
✨ Uploading _routes.json
80
✘ [ERROR] A request to the Cloudflare API (/accounts/10588302399247a4add0cce49f3d28ee/pages/projects/e303-dk/deployments) failed.

An unknown error occured. Contact your account team or Cloudflare
support: https://cfl.re/3WgEyrH. [code: 8000000]
Environment Account ID: 10588302399247a4add0cce49f3d28ee
// package.json
"wrangler": "^3.65.1" (latest)
"@cloudflare/next-on-pages": "^1.12.1", (latest)
"@cloudflare/workers-types": "^4.20240718.0", (latest)
// package.json
"wrangler": "^3.65.1" (latest)
"@cloudflare/next-on-pages": "^1.12.1", (latest)
"@cloudflare/workers-types": "^4.20240718.0", (latest)
Question 1. How can I see the error in detail? Because this generic error 2. Could someone please help me in general related to this error, because I am extremely confused and frustrated. I received this error maybe 20 times today. At this point, I have to commit 1 function and re-run the deployment to see if it will throw an error. It takes ages to make any progress.
12 replies
CDCloudflare Developers
Created by lettucebaran on 7/19/2024 in #pages-help
A request to the Cloudflare API failed
Background To deploy the project, I build it with pnpm next-on-pages, and then deploy it with wrangler pages deploy. Issue When I run the deploy command, then the script throws an error:
Compiled Worker successfully
Uploading Worker bundle
Uploading _routes.json

[ERROR] A request to the Cloudflare API (/accounts/10588302399247a4add0cce49f3d28ee/pages/projects/<PROJECT_NAME>/deployments) failed.

An unknown error occured. Contact your account team or Cloudflare
support: https://cfl.re/3WgEyrH. [code: 8000000]
Compiled Worker successfully
Uploading Worker bundle
Uploading _routes.json

[ERROR] A request to the Cloudflare API (/accounts/10588302399247a4add0cce49f3d28ee/pages/projects/<PROJECT_NAME>/deployments) failed.

An unknown error occured. Contact your account team or Cloudflare
support: https://cfl.re/3WgEyrH. [code: 8000000]
I used to deploy projects a few days ago, but now I can't. How may I start deploying again? Environment
"@cloudflare/next-on-pages": "^1.12.1",
"wrangler": "^3.36.0"
"@cloudflare/next-on-pages": "^1.12.1",
"wrangler": "^3.36.0"
3 replies
CDCloudflare Developers
Created by lettucebaran on 6/15/2024 in #general-help
Fetching R2 blob on the client-side (skipping server)
I uploaded a file using the PutObjectCommand method. It's a public file. I want to access this file on the client-side (by skipping the server). So, I thought of getting the file by fetching the URL, but I don't know the file's URL. Would you recommend this approach to get the image URL? - If so, how can I get/construct the URL? - If not, what would you recommend doing instead? E.g., https://<some_value>.r2.com/path/to/file?
12 replies
CDCloudflare Developers
Created by lettucebaran on 5/20/2024 in #pages-help
How can I access `env.DB` in my Pages/Worker on production?
Steps to reproduce: 1. Clone https://github.com/cjxe/nextjs-d1-drizzle-cloudflare-pages 2. Follow README.md. 3. Run pnpm start or pnpm pages:prod. 4. Launch the web app using your favourite browser. Error:
[Error: Failed to retrieve the Cloudflare request context.]
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
digest: '3614312654'
}
[Error: Failed to retrieve the Cloudflare request context.]
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
digest: '3614312654'
}
I don't get this error when I run on dev due to how next.config.mjs is set up, but I can't make this work on production. The main issue is the Cloudflare pages return an error when it tries running getRequestContext().env.DB in src/server/db/index.ts.
41 replies
CDCloudflare Developers
Created by lettucebaran on 5/17/2024 in #pages-help
Loading different env variables with Nextjs and next-on-pages
Aim I want to call Cloudflare env variables such as:
// ./src/server/db/auth.ts
import { createClient } from '@libsql/client';

export const runtime = 'edge';

export const client = createClient({
url: env.TURSO_DATABASE_URL,
authToken: env.TURSO_AUTH_TOKEN,
});
// ./src/server/db/auth.ts
import { createClient } from '@libsql/client';

export const runtime = 'edge';

export const client = createClient({
url: env.TURSO_DATABASE_URL,
authToken: env.TURSO_AUTH_TOKEN,
});
Problem When I run npx @cloudflare/next-on-pages@1, the Vercel build fails with the following error:
./src/server/db/auth.ts:6:8
Type error: Cannot find name 'env'.

4 |
5 | export const client = createClient({
> 6 | url: env.TURSO_DATABASE_URL,
| ^
7 | authToken: env.TURSO_AUTH_TOKEN,
8 | });
9 |
./src/server/db/auth.ts:6:8
Type error: Cannot find name 'env'.

4 |
5 | export const client = createClient({
> 6 | url: env.TURSO_DATABASE_URL,
| ^
7 | authToken: env.TURSO_AUTH_TOKEN,
8 | });
9 |
So, that makes me think that my configuration is broken.
// ./next.config.mjs
import { setupDevPlatform } from '@cloudflare/next-on-pages/next-dev';

if (process.env.NODE_ENV === 'development') {
await setupDevPlatform({ persist: true });
}

/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;
// ./next.config.mjs
import { setupDevPlatform } from '@cloudflare/next-on-pages/next-dev';

if (process.env.NODE_ENV === 'development') {
await setupDevPlatform({ persist: true });
}

/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;
# ./wrangler.toml

name = "TBC"
compatibility_date = "2024-05-12"
compatibility_flags = ["nodejs_compat"]
pages_build_output_dir = ".vercel/output/static"

[env.preview]
vars = { TURSO_DATABASE_URL = "A", TURSO_AUTH_TOKEN = "B" }


[env.production]
vars = { TURSO_DATABASE_URL = "A", TURSO_AUTH_TOKEN = "B" }
# ./wrangler.toml

name = "TBC"
compatibility_date = "2024-05-12"
compatibility_flags = ["nodejs_compat"]
pages_build_output_dir = ".vercel/output/static"

[env.preview]
vars = { TURSO_DATABASE_URL = "A", TURSO_AUTH_TOKEN = "B" }


[env.production]
vars = { TURSO_DATABASE_URL = "A", TURSO_AUTH_TOKEN = "B" }
I am happy to create .env files, but I want to avoid duplicate data entry (e.g., settings the both env variable in .env.dev and wrangler.toml).
2 replies
CDCloudflare Developers
Created by lettucebaran on 5/16/2024 in #pages-help
How to read error logs for "This deployment failed" by myself?
For example https://33aa7d0d.e303-dijital-kartvizit-2.pages.dev failed. I want to read the logs without having to go through the support team to increase my speed of analysing the problem. How can I do that?
7 replies