Lambo
Lambo
Explore posts from servers
CDCloudflare Developers
Created by Lambo on 6/2/2024 in #pages-help
Mono Repo Deployment With Root Directory
Hi there, I have my Cloudflare Pages site within a mono repo along side my workers. This has worked well, however, I have recently started breaking my code up into several packages via NPM workspaces. This means that the functions/tsconfig.json is extending the one in the root of my mono repo, to avoid having duplicated config. However, because I have the root directory configured to be the pages directory in my mono repo, it can not obviously find the root tsconfig.json I can see two potential fixes to this: - Do not set pages as a root directory, but this would mean pushing more than I need to Pages - Do not extend the functions tsconfig.json and duplicate the config Neither of these approaches seem ideal, does anyone have any other suggestions or recomend a certain way? Thanks
1 replies
CDCloudflare Developers
Created by Lambo on 12/10/2023 in #pages-help
Help With _routes.json File
Hello, I am a bit confused by the _routes.json file. I have added the file to my functions directory with the following config:
{
"version": 1,
"include": ["/*"],
"exclude": ["/", "manifest.json"]
}
{
"version": 1,
"include": ["/*"],
"exclude": ["/", "manifest.json"]
}
I have another file [article].ts in my functions folder with the following code, for testing purposes:
export function onRequest(context) {
console.log('Hit: ' + context.params.article);
return new Response(context.params.article);
}
export function onRequest(context) {
console.log('Hit: ' + context.params.article);
return new Response(context.params.article);
}
My understanding of the _routes.json is that I should not see a Hit log for when I visit my Pages site at http://localhost:8788, however, I see Hit: manifest.json in the logs (nothing for the index route itself). Why is this? Essentially, what I am after is for the static page to load for /, but then all other routes to fallback to my [article].ts function.
1 replies
CDCloudflare Developers
Created by Lambo on 11/29/2023 in #workers-help
Scheduled Worker 504 Gateway Time-out
Hello, I'm suddenly getting a 504 Gateway Time-out when visting http://localhost:8787/__scheduled?cron=*+*+*+*+* to test my scheduled worker via npx wrangler dev --test-scheduled. This only happens when local mode is turned off. If local mode is enabled I just get an error in the console stating the table does not exist (which is correct). I'm not really sure what could have caused this. I am on my master branch which was working a couple days ago, so I have changed no code. Does anyone have ideas on what could cause this? Happy to supply any code/config. Thanks.
6 replies