Registry / communication / parse-server-sendgrid-adapter

parse-server-sendgrid-adapter

JSON →
library1.0.0jsnpmunverified

This package provides a straightforward email adapter for Parse Server, enabling it to send emails via SendGrid's API. It allows Parse Server applications to handle functionalities like user verification and password resets using SendGrid's robust email delivery service. Currently at version 1.0.0, the package appears to be stable and provides a simple integration point for SendGrid. Its primary differentiator is its direct, minimal integration specifically for Parse Server's `emailAdapter` configuration, avoiding more complex or generic email solutions when SendGrid is the chosen provider. Release cadence is likely slow, focusing on stability given its mature 1.0.0 version and niche purpose. It aims to simplify SendGrid setup within a Parse Server environment.

npm install parse-server-sendgrid-adapter
INSTALL
IMPORT
SIG · PARSE-SERVER-SENDG
P
parse-server-sendgrid-adapter
communicationjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SimpleSendGridAdapter
import SimpleSendGridAdapter from 'parse-server-sendgrid-adapter';
import { SimpleSendGridAdapter } from 'parse-server-sendgrid-adapter';
The package's primary export is a default function. If using CommonJS, use `require('parse-server-sendgrid-adapter')`.
SimpleSendGridAdapter (CJS)
const SimpleSendGridAdapter = require('parse-server-sendgrid-adapter');
This is the documented CommonJS import pattern shown in the README, compatible with older Node.js projects or those not using ESM.
ParseServer
import { ParseServer } from 'parse-server';
const ParseServer = require('parse-server').ParseServer;
While Parse Server itself often uses CJS in older examples, modern Parse Server installations (especially with `"type": "module"` in `package.json`) prefer ESM imports. Ensure Parse Server is correctly imported for your environment. The adapter consumes an instance of Parse Server.

This quickstart demonstrates how to integrate `parse-server-sendgrid-adapter` into a basic Parse Server setup using Express. It configures the `emailAdapter` to use SendGrid, emphasizing the importance of environment variables for API keys and other sensitive data.

import express from 'express'; import { ParseServer } from 'parse-server'; import SimpleSendGridAdapter from 'parse-server-sendgrid-adapter'; const app = express(); // Load sensitive configurations from environment variables const databaseURI = process.env.DATABASE_URI || 'mongodb://localhost:27017/dev'; const cloudCodePath = process.env.CLOUD_CODE_PATH || './cloud/main.js'; // Ensure this is an absolute path in production const appId = process.env.PARSE_APP_ID || 'myAppId'; const masterKey = process.env.PARSE_MASTER_KEY || 'myMasterKey'; // KEEP THIS SECRET! const serverURL = process.env.PARSE_SERVER_URL || 'http://localhost:1337/parse'; const publicServerURL = process.env.PARSE_PUBLIC_SERVER_URL || serverURL; const sendgridApiKey = process.env.SENDGRID_API_KEY || 'YOUR_SENDGRID_API_KEY'; const fromEmailAddress = process.env.SENDGRID_FROM_EMAIL || 'no-reply@example.com'; const api = new ParseServer({ databaseURI: databaseURI, cloud: cloudCodePath, appId: appId, masterKey: masterKey, serverURL: serverURL, appName: 'myAppName', publicServerURL: publicServerURL, emailAdapter: SimpleSendGridAdapter({ apiKey: sendgridApiKey, fromAddress: fromEmailAddress, }), }); // Serve the Parse API on the /parse URL prefix app.use('/parse', api); const port = process.env.PORT || 1337; app.listen(port, function() { console.log(`Parse Server running on port ${port}.`); console.log(`Access at ${publicServerURL}`); });
Debug
Known issues
breakingOlder Parse Server installations or those configured with `"type": "module"` in `package.json` may break if mixing CommonJS `require()` with ESM `import` statements. The provided adapter example uses `require`.
fix
For projects with `"type": "module"`, convert `require()` statements to `import` statements or ensure your build process handles CJS modules appropriately. For this specific adapter, use `import SimpleSendGridAdapter from 'parse-server-sendgrid-adapter';`.
affects: N/A (depends on Parse Server and Node.js config)
gotchaHardcoding `apiKey` or `fromAddress` directly in your source code is a severe security vulnerability. These credentials can be exposed if the code is shared publicly (e.g., on GitHub) or compromised.
fix
Always store sensitive information like API keys in environment variables (e.g., `process.env.SENDGRID_API_KEY`) or a secure secrets management system. Update the quickstart code to reflect this best practice.
affects: All
gotchaThe `fromAddress` configured for SendGrid must be a verified sender email or domain in your SendGrid account. Unverified addresses will result in emails failing to send.
fix
Ensure the email address used for `fromAddress` in the adapter configuration is authenticated and verified within your SendGrid account settings.
affects: All
gotchaParse Server's `emailAdapter` expects a specific interface. If `parse-server-sendgrid-adapter` is used with a significantly different Parse Server version than it was developed for, compatibility issues might arise, leading to email sending failures.
fix
Always test the adapter with your specific Parse Server version. Check the adapter's GitHub repository for any reported compatibility issues or updates for newer Parse Server releases.
affects: <1.0.0 (and potentially future Parse Server versions)
Errors
Common errors & fixes
Error: Parse Server is not able to send emails: No adapter is configured for email verification.
The `emailAdapter` was not properly configured or passed to the `ParseServer` constructor.
fix
Ensure `emailAdapter: SimpleSendGridAdapter({ apiKey: '...', fromAddress: '...' })` is correctly added within your `ParseServer` options object.
SendGrid API Error: The provided authorization grant is invalid.
The `apiKey` provided to `SimpleSendGridAdapter` is incorrect, expired, or has insufficient permissions.
fix
Verify your SendGrid API key in your SendGrid account dashboard. Ensure it has permissions to send mail. Generate a new key if necessary and update your environment variable.
SendGrid API Error: The 'from' email address is not verified.
The `fromAddress` specified in the adapter configuration is not a verified sender identity in your SendGrid account.
fix
Go to your SendGrid dashboard, navigate to 'Settings' -> 'Sender Authentication', and verify the `fromAddress` email or domain. Once verified, emails should send successfully.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
parse-serverrequiredThis is an adapter for Parse Server, requiring it as a peer dependency for functionality.
Agent activity
23 hits · last 30 days
node
18
OpenAI (training)
1
Resources