bebraw
bebraw
Explore posts from servers
CDCloudflare Developers
Created by bebraw on 5/24/2024 in #pages-help
Easy way to detect 404 accessed?
Based on Cloudflare statistics, people might be getting 404s for some routes of my site. What is a good way to figure which urls that people actively try to access 404?
1 replies
CDCloudflare Developers
Created by bebraw on 5/9/2024 in #pages-help
How to cache Deno dependencies during a build?
I noticed that in a project of mine where a build takes about 1m 40s installing Deno and related dependencies takes roughly a minute of the build time. I also noticed that Cloudflare Pages supports caching these days and Deno has support for caching as well. Has anyone figured out how to connect these two concepts? Can I tell Cloudflare Pages to use a custom cache location to match the one Deno uses or should I try the other way around?
1 replies
DDeno
Created by bebraw on 4/28/2024 in #help
How to abstract tests to allow running different functions against the same test suite?
I've set up two suites of tests like this: https://github.com/gustwindjs/gustwind/tree/develop/htmlisp/html-tests, https://github.com/gustwindjs/gustwind/tree/develop/htmlisp/html-tests-sync . They are effectively the same but one is for async code and one for sync. Due to how the language works, technically it should be possible to use the async test suite for testing the sync code since await just wraps sync result within a Promise. The question is, what would be a sane way to extract the shared tests and then inject the functions so I could end up with a single test suite against both async and sync functions?
5 replies
CDCloudflare Developers
Created by bebraw on 4/11/2024 in #pages-help
Custom environment variables set for a Pages project get lost
I have set up a small build as follows: https://github.com/survivejs/website-v3/blob/main/build.sh . In addition, I have specified several environment variables through the UI. Since I rely on workers in my Pages project, there is also wrangler.toml in place. The problem is that when building, it's reporting Build environment variables: (none found) and printenv doesn't show any of the environment variables I defined through the UI. Curiously it's also missing variables like CF_PAGES_COMMIT_SHA that should be there based on documentation. Do you know how to configure the project/Wrangler so that these environment variables don't get lost?
4 replies
CDCloudflare Developers
Created by bebraw on 12/20/2023 in #pages-help
Is there an example of how to use Cloudflare Cron Triggers within Cloudflare Pages?
I want to set up an automated build for my website so it's updated once per 30 minutes. Based on documentation, I set up a trigger within my Cloudflare Pages project but it doesn't seem to show up at the UI. Should Cron Triggers work with Cloudflare Pages? Is there a complete example available somewhere? As a workaround, I could set up cron elsewhere and trigger the build but it feels a bit cleaner to have this logic in the same projects.
6 replies
DDeno
Created by bebraw on 7/24/2023 in #help
Parsing HTML/XML
Lately I've been researching how to write a simple HTML/XML -> JSON converter. My syntax isn't completely standard HTML (i.e., <Button> is possible) which makes this a notch harder than it probably should be. Here's an example of how things should work: https://github.com/gustwindjs/gustwind/blob/feat/html-prototype/html-to-breezewind/tests/element_test.ts . The current implementation relies on https://deno.land/x/deno_dom but the problem is that it's losing information for tagName. I cannot use it to tell a button apart from a Button as it's uppercasing the tag by default. As an alternative, I looked into https://deno.land/x/xml but it's losing structural information due to its automatic grouping (i.e., it folds divs within a single array and loses their relative positioning so I cannot map the structure later on to match the original). Any insight on the issue would be valuable. Maybe I have to fork either to add the missing functionality but I hope to avoid that.
4 replies
CDCloudflare Developers
Created by bebraw on 3/7/2023 in #pages-help
Solved - Uploading weirdness - AAGfailed: ParseError
I keep getting messages like this in my build process. The portion is outside of my control:
14:58:30.024 AAGfailed: ParseError: Received a malformed response from the API
14:58:30.024 at fetchInternal (/opt/pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:124423:11)
14:58:30.024 at processTicksAndRejections (node:internal/process/task_queues:96:5)
14:58:30.024 at async fetchResult (/opt/pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:123594:16)
14:58:30.025 at async doUpload (/opt/pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:141976:21)
14:58:30.025 at async run (/opt/pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:141616:26) {
14:58:30.025 text: 'Received a malformed response from the API',
14:58:30.025 notes: [
14:58:30.025 {
14:58:30.025 text: '<!DOCTYPE html>\n' +
14:58:30.025 '<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->\n' +
14:58:30.026 '<!--[if I... (length = 7252)'
14:58:30.026 },
14:58:30.026 { text: 'POST /pages/assets/upload -> 524 ' }
14:58:30.026 ],
14:58:30.026 location: undefined,
14:58:30.026 kind: 'error'
14:58:30.026 } retrying...
14:58:30.024 AAGfailed: ParseError: Received a malformed response from the API
14:58:30.024 at fetchInternal (/opt/pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:124423:11)
14:58:30.024 at processTicksAndRejections (node:internal/process/task_queues:96:5)
14:58:30.024 at async fetchResult (/opt/pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:123594:16)
14:58:30.025 at async doUpload (/opt/pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:141976:21)
14:58:30.025 at async run (/opt/pages/build_tool/js/node_modules/wrangler/wrangler-dist/cli.js:141616:26) {
14:58:30.025 text: 'Received a malformed response from the API',
14:58:30.025 notes: [
14:58:30.025 {
14:58:30.025 text: '<!DOCTYPE html>\n' +
14:58:30.025 '<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->\n' +
14:58:30.026 '<!--[if I... (length = 7252)'
14:58:30.026 },
14:58:30.026 { text: 'POST /pages/assets/upload -> 524 ' }
14:58:30.026 ],
14:58:30.026 location: undefined,
14:58:30.026 kind: 'error'
14:58:30.026 } retrying...
do you know what might be causing this behavior?
2 replies
CDCloudflare Developers
Created by bebraw on 2/17/2023 in #pages-help
How to cancel deployment if any part of the build fails or throws an error?
I set up a tiny build script for my site at https://github.com/ReactFinland/future-frontend-site/blob/main/build.sh . The question is, how can I cancel the current deployment if any part of the script throws an error? Right now that's resulting in semi-working deploys that may be missing files.
5 replies