An example Worker for copying Cloudflare Pub/Sub messages to R2 storage

Overview

pubsub-to-r2

An example Cloudflare Worker that acts as an on-publish hook for Pub/Sub and copies a subset of messages to R2 object storage.

To deploy this to your own account:

  • Update account_id in wrangler.toml to use your own account ID
  • Update the [[r2_buckets]] configuration in wrangler.toml to reference an R2 bucket that exists in your account (see the R2 docs for more details)
  • Update the BROKER_PUBLIC_KEYS environmental variable with the public key set from your own Broker — the .../pubsub/namespaces/{namespace}/brokers/{broker}/publickeys endpoint in the API will return your broker-specific keys (docs)
  • Publish it with wrangler publish

With the Worker deployed, you can then update your Broker configuration to use the Worker as an on-publish hook by setting the on_publish.url field to the URL of your Worker (see the docs).

License

BSD-3-Clause licensed. Copyright Cloudflare, Inc, 2022.

You might also like...

Allow moving/copying/and creation embeds for blocks with drag-n-drop just like Logseq or Roam

Allow moving/copying/and creation embeds for blocks with drag-n-drop just like Logseq or Roam

Demo Features Drag-n-drop for list items in the same pane and between different panes 3 modes: move block, copy block, embed block Automatic reference

Dec 26, 2022

Software for the next generation of social media. https://gitlab.com/soapbox-pub/soapbox-fe

Software for the next generation of social media. https://gitlab.com/soapbox-pub/soapbox-fe

Soapbox FE Soapbox FE is a frontend for Mastodon and Pleroma with a focus on custom branding and ease of use. It's part of the Soapbox project. Try it

Dec 30, 2022

A plugin for Obsidian (https://obsidian.md) that adds a button to its search view for copying the Obsidian search URL.

A plugin for Obsidian (https://obsidian.md) that adds a button to its search view for copying the Obsidian search URL.

Copy Search URL This plugin adds a button to Obsidian's search view. Clicking it will copy the Obsidian URL for the current search to the clipboard. T

Dec 26, 2022

A handy little app for copying & pasting images.

A handy little app for copying & pasting images.

PikPicPASTE A handy little app for copying & pasting images. Usage Click and drag the hamburger tile to move the toolbar Click the hamburger tile to s

Nov 1, 2022

Persistent key/value data storage for your Browser and/or PWA, promisified, including file support and service worker support, all with IndexedDB. Perfectly suitable for your next (PWA) app.

Persistent key/value data storage for your Browser and/or PWA, promisified, including file support and service worker support, all with IndexedDB. Perfectly suitable for your next (PWA) app.

BrowstorJS 🚀 💾 🔒 Persistent key/value data storage for your Browser and/or PWA, promisified, including file support and service worker support, all

Aug 5, 2022

A chat logs online saver for discord bots to save messages history & cleared messages online

A chat logs online saver for discord bots to save messages history & cleared messages online

Chat Logs NPM package that saves messages online to view it later Useful for bots where users can save messages history & cleared messages online Supp

Dec 28, 2022

may-be.gay is a service in which you can register your own sub-domain for your personal website

may-be.gay is a service in which you can register your own sub-domain for your personal website

may-be.gay is a service in which you can register your own sub-domain for your personal website. How to register New method (Recommended) Create a new

Dec 27, 2022

ish.ninja is a free online platform to allocate a unique ish.ninja sub handle name for a BlueSky account.

ish.ninja ish.ninja is a free online platform to allocate a unique ish.ninja sub handle name for a BlueSky account. It is built using Next.js, Xata, T

May 9, 2023

Functional-style Cloudflare Durable Objects with direct API calls from Cloudflare Workers and TypeScript support.

durable-apis Simplifies usage of Cloudflare Durable Objects, allowing a functional programming style or class style, lightweight object definitions, a

Jan 2, 2023
Owner
Matt Silverlock
I care a lot about securing the web, making things fast for users, and good documentation. Maintainer of the @gorilla web toolkit for Go.
Matt Silverlock
An interceptor to validate and decode Pub/Sub push messages for endpoints

NestJS GCP Pub/Sub Interceptor Provides an Interceptor for NestJS to automagically validate and unwrap HTTP push messages from Google Cloud Platform's

Hiphops 3 Dec 15, 2022
Connect to a Postgres database from a Cloudflare Worker, using Cloudflare Tunnel

Cloudflare Workers Postgres Client This is an experimental module. Heavily based on cloudflare/worker-template-postgres, but cleaned up and bundled in

BubblyDoo 17 Dec 22, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A Cloudflare Worker for fetching data from Twitter User API.

cloudflare-worker-twitter This is a Cloudflare Worker for fetching data from Twitter User API. ❔ About this project I created this Worker to hide my A

Arda Soytürk 12 Oct 1, 2022
A cloudflare worker to use the user-agent for ~~rickrolling~~ without a discord embed

nextcord.gay A cloudflare worker to use the user-agent for rickrolling without a discord embed Build npm run build Find the output in ./dist/worker.mj

Oliver Wilkes 10 Oct 4, 2022
Cloudflare worker function to update github bio automatically with leetcode and codeforces profile stats 🚀

Stats check ?? Cloudflare worker function to update github bio automatically with leetcode and codeforces profile stats ?? You can see it in action he

Vaibhav Chopra 2 Feb 15, 2022
A cloudflare worker based REST API for your R2 bucket.

A cloudflare worker based REST API for your R2 bucket. Usage: Change the bucket_name and preview_bucket_name in wrangler.toml if you want. Set ENCRYPT

Proselog 19 Nov 7, 2022
A CloudFlare Worker / script / bot to sync Notion pages publicly as GitHub Discussions.

notion-github-sync This bot syncs public Notion pages as GitHub Discussions/Issues. It's done periodically, based on the pages shared with the Notion

The Guild 20 Dec 22, 2022