Vlady
Vlady
CDCloudflare Developers
Created by Vlady on 11/17/2024 in #workers-help
How would you force a worker custom domain to open in https?
Found it ✅
2 replies
CDCloudflare Developers
Created by Vlady on 7/17/2024 in #pages-help
My app is 10 times slower in production
The only thing that could raise concerns is not loading the modules fast enough because I do a bunch of dynamic importing in getLoadContext because the worker times out if I import synchronously :/
3 replies
CDCloudflare Developers
Created by Vlady on 7/17/2024 in #pages-help
My app is 10 times slower in production
I've timed every function call in my entry.server.tsx using Server-Timing headers and I don't see anything wrong here
export default async function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext,
context: AppLoadContext,
) {
let t1 = performance.now()

let app = (
<ThemeProvider theme={mTheme}>
<I18nProvider locale="en-GB">
<ApolloProvider client={context.gqlClient}>
<RemixServer context={remixContext} url={request.url} />
</ApolloProvider>
</I18nProvider>
</ThemeProvider>
)

let t2 = performance.now()
context.timing.recordManualTiming('App render', t2 - t1)

await getDataFromTree(app)

let t3 = performance.now()
context.timing.recordManualTiming('getDataFromTree', t3 - t2)

let gqlState = context.gqlClient.extract()

app = (
<ApolloStateContext.Provider value={gqlState}>
{app}
</ApolloStateContext.Provider>
)

let markup = renderToString(app)

let t4 = performance.now()
context.timing.recordManualTiming('renderToString', t4 - t3)

responseHeaders.set('Content-Type', 'text/html')

let timingHeader = context.timing.getHeaderField()
responseHeaders.set('Server-Timing', timingHeader)

let response = new Response('<!DOCTYPE html>' + markup, {
headers: responseHeaders,
status: responseStatusCode,
})

return response
}
export default async function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext,
context: AppLoadContext,
) {
let t1 = performance.now()

let app = (
<ThemeProvider theme={mTheme}>
<I18nProvider locale="en-GB">
<ApolloProvider client={context.gqlClient}>
<RemixServer context={remixContext} url={request.url} />
</ApolloProvider>
</I18nProvider>
</ThemeProvider>
)

let t2 = performance.now()
context.timing.recordManualTiming('App render', t2 - t1)

await getDataFromTree(app)

let t3 = performance.now()
context.timing.recordManualTiming('getDataFromTree', t3 - t2)

let gqlState = context.gqlClient.extract()

app = (
<ApolloStateContext.Provider value={gqlState}>
{app}
</ApolloStateContext.Provider>
)

let markup = renderToString(app)

let t4 = performance.now()
context.timing.recordManualTiming('renderToString', t4 - t3)

responseHeaders.set('Content-Type', 'text/html')

let timingHeader = context.timing.getHeaderField()
responseHeaders.set('Server-Timing', timingHeader)

let response = new Response('<!DOCTYPE html>' + markup, {
headers: responseHeaders,
status: responseStatusCode,
})

return response
}
3 replies
CDCloudflare Developers
Created by yeehow on 5/6/2024 in #pages-help
Build Node/PNPM version errors
Creating a .node-version package with the contents of v20.13.1 seems to work for me
5 replies
CDCloudflare Developers
Created by yeehow on 5/6/2024 in #pages-help
Build Node/PNPM version errors
For me it doesn't even pick up the [vars] in wrangler.toml
5 replies
CDCloudflare Developers
Created by yeehow on 5/6/2024 in #pages-help
Build Node/PNPM version errors
I have the same problem, looks like the dashboard variables are ignored
5 replies
CDCloudflare Developers
Created by shengyuan on 4/15/2024 in #workers-help
How to test two binding workers in dev environment?
I restarted my computer and it found the other worker 🤷🏼‍♂️ ✅
5 replies
CDCloudflare Developers
Created by shengyuan on 4/15/2024 in #workers-help
How to test two binding workers in dev environment?
Hey folks, is there a way to explicitly point to the port of the other instance of wrangler? I'm trying to proxy a local API worker from a pages, but getting this error
[wrangler] Couldn't find `wrangler dev` session for service "yupty-api" to proxy to
[wrangler] Couldn't find `wrangler dev` session for service "yupty-api" to proxy to
My pages project config:
name = "front"
dev.port = 3000
services = [
{ binding = "API", service = "yupty-api" }
]
name = "front"
dev.port = 3000
services = [
{ binding = "API", service = "yupty-api" }
]
My API project config:
name = "yupty-api"
dev.port = 3010
name = "yupty-api"
dev.port = 3010
5 replies
CDCloudflare Developers
Created by Vlady on 4/25/2024 in #pages-help
How to expose branch preview URL to public domain (branch.myapp.pages.dev -> branch.myapp.com)
No description
6 replies