Marcus
Marcus
CDCloudflare Developers
Created by Anthony on 8/2/2024 in #kv
How do you modify every KV entry without
The binding is limited to 1000/request, right?
5 replies
CDCloudflare Developers
Created by Marcus on 3/12/2024 in #workers-help
simplest static asset hosting
Which is why I love this platform, of course; KV is great; KV being wrapped so it acts like a static asset folder is great! Using the Pages stack for something it's technically not intended for feels silly, but if there's a similar wrapper for KV that's just a part of the developer platform under assets I'd love to use that; I just don't see any documentation about it.
20 replies
CDCloudflare Developers
Created by Marcus on 3/12/2024 in #workers-help
simplest static asset hosting
Will look through that. But I meant more, backing up, that the user would have to be instructed to make an R2 binding and add it to one or multiple config files as part of using the template to make a bot, yeah? While the bucket = "./public" method is zero config, as one would reasonably expect
20 replies
CDCloudflare Developers
Created by Marcus on 3/12/2024 in #workers-help
simplest static asset hosting
Hm, the setup process for this doesn't seem very suited to "here's a template repo that you can clone, put assets in a folder, and run a github action to sync"
20 replies
CDCloudflare Developers
Created by Marcus on 3/12/2024 in #workers-help
simplest static asset hosting
Right, yeah, the linked issue seemed to be well-targeted toward finding a solution to just this sort of thing with good devx, and then it wasn't clear to be if the resolution it was closed with actually does that
20 replies
CDCloudflare Developers
Created by Marcus on 3/12/2024 in #workers-help
simplest static asset hosting
Yeah, that was why I wanted to figure out the semantic way to do it :D @cloudflare/kv-asset-handler definitely works, but it seemed like it was intended to be deprecated?
20 replies
CDCloudflare Developers
Created by Marcus on 3/12/2024 in #workers-help
simplest static asset hosting
Is there a nice way to have a folder in the repo synced to R2 (e.g. from wrangler cli)?
20 replies
CDCloudflare Developers
Created by Marcus on 3/12/2024 in #workers-help
simplest static asset hosting
(and made a separate repo that's just a folder of images and uploaded that as a pages site)
20 replies
CDCloudflare Developers
Created by Marcus on 3/12/2024 in #workers-help
simplest static asset hosting
But to have a bot command respond with an image, I'm currently just fetching my-static-files.pages.dev/some-image.png
20 replies
CDCloudflare Developers
Created by Marcus on 3/12/2024 in #workers-help
simplest static asset hosting
I don't have the version of it with assets public yet; got to strip some secrets and stuff
20 replies
CDCloudflare Developers
Created by Marcus on 3/12/2024 in #workers-help
simplest static asset hosting
20 replies
CDCloudflare Developers
Created by Marcus on 3/12/2024 in #workers-help
simplest static asset hosting
Well, the application is just a Discord bot. Deploying it as a Function would be my second bullet point option, yeah? Using the Pages stack despite not having a site to actually deploy?
20 replies
CDCloudflare Developers
Created by Marcus on 1/5/2024 in #pages-help
pages-action branch preview URL
For anyone who finds this via search, it looks like there are a number of issues with cloudflare/pages-action that prevent this from working, as noted in the issues for the repo: a) one needs to manually set the deployment branch to ${{ github.head_ref || github.ref_name }} even though the documentation suggests you don't, and b) even if you do, outputs.alias doesn't work. The wrangler action is way more updated (supports pnpm, for one), and you can use command: pages deploy with it, but it doesn't output the branch URL (or make a github deployment?) either. For now I just faked the whole thing:
- name: Deploy preview to Cloudflare
uses: cloudflare/pages-action@1
id: pages-action
with:
apiToken: ${{ secrets.CI_CF_PAGES }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
projectName: ${{ env.PAGES_PROJECT_NAME }}
directory: dist
branch: ${{ github.head_ref || github.ref_name }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Deployed ${{ steps.pages-action.outputs.environment }} build to Cloudflare!

| | |
| ----------------------- | - |
| **Last commit:** | ${{ github.event.pull_request.head.sha || github.event.workflow_run.head_sha || github.sha }} |
| **Preview URL**: | ${{ steps.pages-action.outputs.url }} |
| **Branch Preview URL**: | https://${{ github.head_ref || github.ref_name }}.${{ env.PAGES_PROJECT_NAME }}.pages.dev |
comment_tag: deployment
mode: upsert
- name: Deploy preview to Cloudflare
uses: cloudflare/pages-action@1
id: pages-action
with:
apiToken: ${{ secrets.CI_CF_PAGES }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
projectName: ${{ env.PAGES_PROJECT_NAME }}
directory: dist
branch: ${{ github.head_ref || github.ref_name }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Deployed ${{ steps.pages-action.outputs.environment }} build to Cloudflare!

| | |
| ----------------------- | - |
| **Last commit:** | ${{ github.event.pull_request.head.sha || github.event.workflow_run.head_sha || github.sha }} |
| **Preview URL**: | ${{ steps.pages-action.outputs.url }} |
| **Branch Preview URL**: | https://${{ github.head_ref || github.ref_name }}.${{ env.PAGES_PROJECT_NAME }}.pages.dev |
comment_tag: deployment
mode: upsert
4 replies