F0rce
F0rce
Explore posts from servers
CDCloudflare Developers
Created by F0rce on 1/22/2024 in #pages-help
Debugging SSR Page
What is the best way to debug a 1101 Error and tail says Error: The script will never return a response. For context we are hosting an astro site with SSR as a "sandbox" environment for customers to test CMS changes before deploying (the final page is static). But for some "some minutes - minutes could also last for 20-25 minutes" the page works perfeclty fine and then for a long time there is the 1101 Error and I really cant find a way to debug, etc. Any help / direction would be really appreciated. moved from #Debugging SSR Page
41 replies
CDCloudflare Developers
Created by F0rce on 1/16/2024 in #workers-help
Debugging SSR Page
What is the best way to debug a 1101 Error and tail says Error: The script will never return a response. For context we are hosting an astro site with SSR as a "sandbox" environment for customers to test CMS changes before deploying (the final page is static). But for some "some minutes - minutes could also last for 20-25 minutes" the page works perfeclty fine and then for a long time there is the 1101 Error and I really cant find a way to debug, etc. Any help / direction would be really appreciated.
5 replies
CDCloudflare Developers
Created by F0rce on 7/14/2023 in #workers-help
Logging Service Best Practice (Service Workers)
Hello everyone, I want to build something with workers and I am not sure if it works out, thats why im asking POGGIES Basically I have some workers and I want to add some oberservability to it. I would like to use Service Bindings for that. Now here's the question I have. I have the following in mind. Request is made to Worker One (availible online). It does it normal job does some additional "pre-parsing" for the logger (saving some request headers / response headers). The request where the original reqeust is made to does a subrequest (through a Service Binding) to the logger worker. Due to limitation of our log provider (axiom) I would not be able to ingest every request when it happens. How would I have to build the logger service, that it throttles the requests made ? or is there a better solution to what I'm thinking. I'm open for all sorts of "help". What would the best practices be for that sort of case. KV ? Durable Objects ? A cron that iterates the KV keys... etc. Thanks <:blob_wave:753870952873590814>
5 replies
DTDrizzle Team
Created by F0rce on 5/19/2023 in #help
executing an `update` statement does not use `.onUpdateNow()` defined in schema
Hello everyone 🙂 I have the following schema for my USERS table:
export const users = mysqlTable("USERS", {
id: varchar("ID", { length: 21 }).notNull().primaryKey(),
hostname: varchar("HOSTNAME", { length: 253 }).notNull(),
email: varchar("EMAIL", { length: 320 }).notNull(),
verified: boolean("VERIFIED").notNull().default(false),
createdAt: timestamp("CREATED_AT").notNull().defaultNow(),
updatedAt: timestamp("UPDATED_AT").onUpdateNow(),
});
export const users = mysqlTable("USERS", {
id: varchar("ID", { length: 21 }).notNull().primaryKey(),
hostname: varchar("HOSTNAME", { length: 253 }).notNull(),
email: varchar("EMAIL", { length: 320 }).notNull(),
verified: boolean("VERIFIED").notNull().default(false),
createdAt: timestamp("CREATED_AT").notNull().defaultNow(),
updatedAt: timestamp("UPDATED_AT").onUpdateNow(),
});
As I understand correctly, as soon as I use db.update(users)... the updatedAt should be automatically be set to new Data:
await db
.update(users)
.set({
...(putUser.email ? { email: putUser.email } : {}),
...(putUser.url ? { hostname: new URL(putUser.url).hostname } : {}),
})
.where(eq(users.id, user.id));
await db
.update(users)
.set({
...(putUser.email ? { email: putUser.email } : {}),
...(putUser.url ? { hostname: new URL(putUser.url).hostname } : {}),
})
.where(eq(users.id, user.id));
The email and hostname values are updated accordingly but the updatedAt column does not seem to be touched. Am I missunderstanding something here ? Thanks in advance, David
7 replies
CDCloudflare Developers
Created by F0rce on 5/19/2023 in #workers-help
Wrangler@3 -- wrangler dev uses random port all the time
Hello everyone, before upgrading to wrangler@3 (and now using the fully local development mode) the port was normally on 8787. Now each start of the environment seems to have a random port (at the time of trying its 64278). As the Port is not always the same and a new restart creates a new port, it is a pain to update the development frontend env or my api testing client (insomnia) to always be at the correct port. Is this a bug on macOS or is there a way to force the port to be at 8787 ? Thanks in advance, David
8 replies
CDCloudflare Developers
Created by F0rce on 5/3/2023 in #pages-help
Custom Branch Domain with Cloudflare Access fails
20 replies
CDCloudflare Developers
Created by F0rce on 4/11/2023 in #workers-help
Empty KV eventhough preview KV has values during Vitest
Hello everyone, basically the title already tells what my problem is, which I can't seem to get to work. Basically with a CI pipeline I want to test my worker (which is basically a REST api). It should use the preview KV I am using in development. But the KV is always empty. It seems like in my implementation it is using the production KV. Could anyone help me with it ?
import { unstable_dev } from "wrangler";
import type { UnstableDevWorker } from "wrangler";
import { describe, expect, it, beforeAll, afterAll } from "vitest";

describe("API", () => {
let worker: UnstableDevWorker;

beforeAll(async () => {
worker = await unstable_dev("src/index.ts", {
config: "wrangler.toml",
experimental: { disableExperimentalWarning: true },
});
});

afterAll(async () => {
await worker.stop();
});

it("should return test user", async () => {
const resp = await worker.fetch("/api/v1/users/<id>", {
headers: { "X-Auth-Token": "shared-key" },
});
if (resp) {
const json = await resp.json();
expect(json).toMatchObject({
email: "user-mail",
});
}
});
});
import { unstable_dev } from "wrangler";
import type { UnstableDevWorker } from "wrangler";
import { describe, expect, it, beforeAll, afterAll } from "vitest";

describe("API", () => {
let worker: UnstableDevWorker;

beforeAll(async () => {
worker = await unstable_dev("src/index.ts", {
config: "wrangler.toml",
experimental: { disableExperimentalWarning: true },
});
});

afterAll(async () => {
await worker.stop();
});

it("should return test user", async () => {
const resp = await worker.fetch("/api/v1/users/<id>", {
headers: { "X-Auth-Token": "shared-key" },
});
if (resp) {
const json = await resp.json();
expect(json).toMatchObject({
email: "user-mail",
});
}
});
});
1 replies