Skip to content

Instantly share code, notes, and snippets.

View bertolo1988's full-sized avatar
🎯
Focusing

Tiago BΓ©rtolo bertolo1988

🎯
Focusing
View GitHub Profile

How to Send an Event to EventBridge

Amazon EventBridge is a serverless event bus. You publish events to it and rules route them to targets like Lambda, SQS, or CloudWatch Logs. This article shows how to send a typed event to EventBridge using TypeScript and the AWS SDK V3.

Prerequisites

  • Node.js 18+
  • An AWS account with an EventBridge event bus

Install the dependencies:

How to Replay SQS Events

Sometimes a message fails to process and ends up in a dead-letter queue, or you need to re-send an event to test a fix. Instead of clicking through the AWS console, you can write a small TypeScript script that sends any typed payload straight to an SQS queue.

This article walks through building two pieces:

  1. A producer script that accepts a typed body and sends it to a queue.
  2. A consumer that polls the queue and processes each message by type.

Prerequisites

@bertolo1988
bertolo1988 / auto_nvm_use.zsh
Last active January 16, 2026 12:02
Snippet of code for .zshrc config to run "nvm use" command if .nvmrc file is present in the directory
# Automatically call nvm use on directory change
# Only changes version if .nvmrc is found
autoload -U add-zsh-hook
load-nvmrc() {
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
@bertolo1988
bertolo1988 / wallet-address-signature-demo.js
Created March 17, 2023 11:45
Verify ethereum wallet ownership remotely.
/**
First install and run ganache.
> npm install ganache --global
> execute this code https://gist.github.com/bertolo1988/096d436f072d2513eb4ff1cd83201c47
**/
const Web3EthAccounts = require('web3-eth-accounts');
const PORT = 61063;
@bertolo1988
bertolo1988 / eip-1193-provider.js
Created March 17, 2023 11:44
Launches an EIP-1193 provider locally.
const ganache = require('ganache');
const options = {};
const server = ganache.server(options);
const PORT = 0; // 0 means any available port
server.listen(PORT, async (err) => {
if (err) throw err;
console.log(`ganache listening on port ${server.address().port}...`);
});
Method name clone is callable typeof is function enumerable properties name prototype constructor clone is independent
cloneJSON ❌ ❌ ❌ ❌ ❌ ❌ ❌
structuredClone ❌ ❌ ❌ ❌ ❌ ❌ ❌
underscoreContribClone βœ… βœ… βœ… βœ… βœ… βœ… ❌
cloneNemisj βœ… βœ… βœ… βœ… βœ… βœ… ❌
cloneTrincot ❌ βœ… βœ… ❌ ❌ βœ… βœ…
cloneKoolDandy βœ… βœ… βœ… βœ… βœ… βœ… ❌
cloneRfdc βœ… βœ… βœ… βœ… βœ… βœ… ❌
justClone βœ… βœ… βœ… βœ… βœ… βœ… ❌
cloneDeep βœ… βœ… βœ… βœ… βœ… βœ… ❌
Method name should clone an object with circular reference to an element of the array
cloneJSON ❌
structuredClone βœ…
underscoreContribClone ❌
cloneNemisj ❌
cloneTrincot βœ…
cloneKoolDandy ❌
cloneRfdc βœ…
justClone ❌
cloneDeep ❌
Method name __proto__ by referencing clones the __proto__ non enumerable properties in the prototype
cloneJSON ❌ ❌ ❌
structuredClone ❌ βœ… ❌
underscoreContribClone ❌ ❌ ❌
cloneNemisj ❌ ❌ ❌
cloneTrincot ❌ ❌ ❌
cloneKoolDandy ❌ ❌ ❌
cloneRfdc ❌ ❌ ❌
justClone ❌ ❌ ❌
cloneDeep βœ… ❌ βœ…
Method name frozen sealed non extensible
cloneJSON ❌ ❌ ❌
structuredClone ❌ ❌ ❌
underscoreContribClone ❌ ❌ ❌
cloneNemisj ❌ ❌ ❌
cloneTrincot ❌ ❌ ❌
cloneKoolDandy ❌ ❌ ❌
cloneRfdc ❌ ❌ ❌
justClone ❌ ❌ ❌
cloneDeep ❌ ❌ ❌
Method name getter setter enumerable non enumerable enumerable and writable non enumerable non writable and configurable non enumerable writable and non configurable non enumerable non writable and non configurable own symbol
cloneJSON ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
structuredClone ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
underscoreContribClone ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
cloneNemisj ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
cloneTrincot ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
cloneKoolDandy ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
cloneRfdc ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
justClone ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌
cloneDeep ❌ ❌ βœ… ❌ ❌ ❌ ❌ ❌ ❌