Socket
Socket
Sign inDemoInstall

@discue/idempotent-firebase-functions

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@discue/idempotent-firebase-functions

Implementation of idempotent functions for firebase to prevent duplicate execution of events.


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Vue logo


GitHub tag Latest Stable Version License
NPM Downloads NPM Downloads
contributions - welcome Made with Node.js

idempotent-firebase-functions

Because firebase does not guarentee firestore events get triggered only once, we need to ensure idempotency ourselves. This module provides helper functions to create idempotent functions easily.

Components

Example

Examples

import { onDocumentWritten } from 'firebase-functions/v2/firestore';
import { idempotentFunction } from '@discue/idempotent-firebase-functions';
import handler from './handler.js'

const DOCUMENT_PATH = 'api_clients/{apiClientId}/queues/{queueId}/messages/{messageId}'
// handler function will only be called once per firebase event id
// effectively making it an idempotent function
export const written = onDocumentWritten(DOCUMENT_PATH, idempotentFunction(handler))

Installation

npm install @discue/idempotent-firebase-functions

Run E2E Tests

To run tests, run the following command

./test-e2e.sh

License

MIT

Keywords

FAQs

Package last updated on 10 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc