New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@apitraffic/meteor

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apitraffic/meteor

Meteor integration for ApiTraffic: request capture and the ApiTraffic firewall, with APM through @apitraffic/apm, on Meteor's WebApp.

latest
Source
npmnpm
Version
3.0.0
Version published
Weekly downloads
227
-61.91%
Maintainers
1
Weekly downloads
 
Created
Source




Website   •   Docs   •   Meteor Docs   •   X   •   Discord

npm license

@apitraffic/meteor is ApiTraffic for Meteor, mounted on Meteor's WebApp. Call mount() once from your server's main module and every HTTP request your Meteor server serves is recorded - request and response, headers, bodies, timing, the route your handlers matched, and the outbound HTTP calls made while serving it - and checked by the ApiTraffic firewall: your REST endpoints in WebApp.handlers, the handlers packages add, static assets, and the app's page itself.

It is @apitraffic/node, the one-install SDK, wired into Meteor. It contains no capture, firewall or instrumentation logic of its own: Meteor 3's WebApp is an Express application, so requests are recorded by @apitraffic/express and checked by @apitraffic/waf, exactly as in a plain Express application. What actually runs - the firewall, redaction, exclusions, span capture - is switched on from your ApiTraffic account, not in code.

Contents

Which package should I use?

On Meteor, use this package. It is @apitraffic/node placed where Meteor needs it: capture and the firewall at the very head of WebApp.rawHandlers, ahead of everything else Meteor does with a request, plus a firewall() you can mount after your own body parser. Mounting @apitraffic/express on WebApp.handlers yourself records only what reaches your handlers.

For other frameworks, see the "Which package should I install?" table in the @apitraffic/node README.

Requirements

  • Meteor 3, which runs on Node 20 and later: 3.0, whose WebApp is built on Express 4, and 3.1 and later, on Express 5. Meteor 2 runs on Node 14, which ApiTraffic does not support, and its Connect-based WebApp is not mounted on.
  • The webapp package (present in every Meteor app that serves HTTP). mount() runs on the server only.
  • Outbound HTTPS from your servers to ingest.apitraffic.io (telemetry) and api.apitraffic.io (settings and live configuration). Live configuration changes (redaction rules, exclusions, firewall policy) are pushed over a realtime connection to Ably, so also allow its realtime hosts; if that connection is blocked, live updates wait for a restart and nothing else is affected.
  • An ingest token and a bucket ID from your ApiTraffic account. See API tokens.

Installation

meteor npm install @apitraffic/meteor

or, with the npm of your own Node installation:

npm install @apitraffic/meteor

@apitraffic/node comes with it as a dependency. The examples below that parse bodies use Express's body parser, from express in your own dependencies (meteor npm install express): the copy Meteor's webapp package bundles is not one your code can import.

Quick start

Set your credentials in the environment:

export API_TRAFFIC_TOKEN=your-ingest-token
export API_TRAFFIC_BUCKET=your-bucket-id

Call mount() once, on the server, as early in your main module as you can:

// server/main.js
import { mount } from '@apitraffic/meteor';

// Token and bucket come from API_TRAFFIC_TOKEN and API_TRAFFIC_BUCKET.
mount();

mount(options?, webApp?) finds the running server's WebApp itself (Package.webapp.WebApp). To be explicit, pass the one from meteor/webapp:

import { WebApp } from 'meteor/webapp';
import { mount } from '@apitraffic/meteor';

mount({ token: process.env.API_TRAFFIC_TOKEN, bucket: process.env.API_TRAFFIC_BUCKET }, WebApp);

It mounts once per WebApp, however many times it is called, and returns whether that call mounted (false on the client, without a Meteor 3 WebApp, or when the WebApp already has ApiTraffic). Settings from Meteor.settings work as any other options do:

import { Meteor } from 'meteor/meteor';
import { mount } from '@apitraffic/meteor';

mount(Meteor.settings.apiTraffic);

Where it mounts

WebApp runs rawHandlers ahead of everything else it does - compression, the ROOT_URL_PATH_PREFIX check, static files, Meteor's internal handlers, the handlers packages and your application add to WebApp.handlers, and the app's page.

  • Capture, then the firewall, take the first place in WebApp.rawHandlers, ahead of raw handlers packages added before your code ran (on Express 4, behind Express's own query and expressInit layers, so req.ip, req.protocol and req.query are what your code sees).
  • firewall(), mounted by you after a body parser, runs the same firewall again once the body is parsed. Meteor parses no request bodies itself, so the firewall at the head of rawHandlers sees none:
import express from 'express';
import { WebApp } from 'meteor/webapp';
import { firewall } from '@apitraffic/meteor';

WebApp.handlers.use(express.json(), firewall());

express is not a Meteor dependency by default: add it with meteor npm install express. express.json() consumes JSON bodies for every later handler, so if one needs the raw body (a webhook that verifies a signature over it, say), mount the pair on your API path only, for example WebApp.handlers.use('/api', express.json(), firewall()).

Call mount() before your other server code adds handlers: the earlier it runs, the less of Meteor's startup it misses.

Configuration

Options are passed to mount(), or set as environment variables. You can mix the two.

Precedence: an option passed in code wins over its environment variable, which wins over the built-in default. With every option in the environment, mount() with no arguments is a complete setup. On top of that, settings from your ApiTraffic account - redaction rules, exclusions, the firewall policy, APM capture switches - are loaded at startup and pushed to every connected server in real time, without a restart or a deploy.

A few settings combine differently:

SettingRule
Firewall on or offOff if either waf: false is passed or API_TRAFFIC_WAF_ENABLED is exactly false or 0, or off in any case. This variable does not use the switch parser below: FALSE, no or a value with spaces leaves the firewall on. Neither can turn on a firewall your account has not enabled.
waf.offlineWafModeAPI_TRAFFIC_OFFLINE_WAF_MODE wins over the code option, so you can change it during an incident without a deploy. Only exactly closed (lowercase) means closed: any other non-empty value, such as CLOSED, still overrides the option and fails open.
captureStatementParams, captureRedisKeysOn if your code or environment turns it on, or the bucket's APM Capture settings do.
captureCallSiteThe bucket's APM Capture setting applies unless you set it in code or the environment. Set locally it can only turn code location on for the SDK's own spans: a local false does not override a bucket that has it on. The APM bridge reads API_TRAFFIC_CAPTURE_CALL_SITE (or its own captureCallSite option) itself, so a false there does turn it off for OpenTelemetry spans.
captureStackDepthThe bucket's APM Capture setting applies unless you set it in code or the environment, which then wins.
interceptOutboundA blank value ("", null, an empty variable) turns outbound capture off. For the other switches, limits, sample rates, token, bucket and accountSid, a blank value counts as not set (apiHost and ingestHost fall back only when empty; a value of spaces is used as given). Two exceptions: passing debug at all, even as undefined, overrides API_TRAFFIC_DEBUG, and a blank projectRoot in code skips API_TRAFFIC_PROJECT_ROOT.

Switches and numeric limits also accept strings (true/false, yes/no, on/off, 1/0; whole numbers for byte caps), so { captureSpans: process.env.CAPTURE_SPANS } works. An invalid value is reported once on the console and ignored. debug and strict are not parsed from strings in code - pass true or false, which matters for values from Meteor.settings - and API_TRAFFIC_DEBUG turns debug on only when it is exactly true (any case).

Options

OptionEnvironment variableTypeDefaultDetails
tokenAPI_TRAFFIC_TOKENstring-Required. Ingest token from your ApiTraffic account.
bucketAPI_TRAFFIC_BUCKETstring-Required. ID of the bucket captured traffic is sent to.
wafAPI_TRAFFIC_WAF_ENABLEDfalse or objectunsetLocal override for the firewall. false refuses it whatever the dashboard says; an object passes settings to @apitraffic/waf (and enabled: false in it turns the firewall off too). Normally left unset.
debugAPI_TRAFFIC_DEBUGbooleanfalseLog SDK activity to the console.
strict-booleanfalseMakes the base client's setup() throw on misconfiguration (missing token or bucket) instead of logging. This package runs setup in the background and catches that error, so strict does not stop your app from booting, and the missing-token message is then printed only when API_TRAFFIC_DEBUG is set. Leave it off.
accountSidAPI_TRAFFIC_ACCOUNT_SIDstringlearned from settingsOnly needed by a process that mints embed tokens without serving requests.
apiHostAPI_TRAFFIC_API_HOSTstringapi.apitraffic.ioSettings and configuration host.
ingestHostAPI_TRAFFIC_INGEST_HOSTstringingest.apitraffic.ioHost captured traffic is sent to.
interceptOutboundAPI_TRAFFIC_INTERCEPT_OUTBOUNDswitchtrueCapture outbound http, https and fetch calls.
captureFetchAPI_TRAFFIC_CAPTURE_FETCHswitchtrueCapture outbound global fetch (needs interceptOutbound).
redactSensitiveKeysAPI_TRAFFIC_REDACT_SENSITIVE_KEYSswitchtrueMask credential-shaped body keys and query parameters.
maxBodyBytesAPI_TRAFFIC_MAX_BODY_BYTESbytes524288 (512 KB)Largest request or response body sent; a larger one is cut to the cap and ends with …[truncated by ApiTraffic: N bytes total].
maxRedactBodyBytesAPI_TRAFFIC_MAX_REDACT_BODY_BYTESbytes1048576 (1 MB)Largest body the SDK redacts; a larger one becomes a placeholder first.
maxFetchBodyLengthAPI_TRAFFIC_MAX_FETCH_BODY_LENGTHbytes524288 (512 KB)Largest outbound body captured.
requestSampleRateAPI_TRAFFIC_REQUEST_SAMPLE_RATE0–11Fraction of requests sent. 5xx responses are always sent.
ingestBatchAPI_TRAFFIC_INGEST_BATCHswitchtrueBatch payloads when your account and the ingest host support it.
ingestGzipAPI_TRAFFIC_INGEST_GZIPswitchtrueCompress those batches when your account asks for it.
captureSpansAPI_TRAFFIC_CAPTURE_SPANSswitchtrueMaster switch for spans and per-request span rollups.
captureStatementsAPI_TRAFFIC_CAPTURE_STATEMENTSswitchtrueInclude normalized SQL/command text in spans.
captureStatementParamsAPI_TRAFFIC_CAPTURE_STATEMENT_PARAMSswitchfalseAlso keep statements as issued, with bind values (your users' data).
captureRedisKeysAPI_TRAFFIC_CAPTURE_REDIS_KEYSswitchfalseInclude the concrete Redis key, unmasked.
captureCallSiteAPI_TRAFFIC_CAPTURE_CALL_SITEswitchtrue (bucket setting)Record the application code location that started each span.
captureStackDepthAPI_TRAFFIC_CAPTURE_STACK_DEPTHwhole number ≥ 010 (bucket setting)Application frames kept per span.
projectRootAPI_TRAFFIC_PROJECT_ROOTstringdetectedDirectory code locations are reported relative to. Set it if code locations come out wrong in a meteor build bundle.
redisKeyPatterns-array of strings or RegExps[]Redis key patterns the automatic masking cannot infer.
maxSpansPerRequestAPI_TRAFFIC_MAX_SPANS_PER_REQUESTcount500Spans kept per request.
spanSampleRateAPI_TRAFFIC_SPAN_SAMPLE_RATE0–11Fraction of requests that keep full span detail.
maxSpanMetaBytesAPI_TRAFFIC_MAX_SPAN_META_BYTESbytes2048Size cap on each span's metadata, after redaction.

Delivery to ApiTraffic honours HTTPS_PROXY, HTTP_PROXY, ALL_PROXY and NO_PROXY. The configuration reference covers the long tail: firewall options, the APM preload's own options, offline definitions and server labels.

What gets captured

Every HTTP request WebApp serves, including the ones your code never sees, with its final status and whatever your code tagged on the way:

  • your endpoints in WebApp.handlers, with the route they matched,
  • a request a package's handler answers itself,
  • a static asset from the client bundle or public/,
  • the app's page (the HTML Meteor serves for a client-side route), and Meteor's 405 for a method other than GET or HEAD on it,
  • a request whose handler throws, as the response Express's error handling sent.

The route your WebApp.handlers matched is sent with each request, mounted routers and ROOT_URL_PATH_PREFIX included, so router.get('/items/:itemId') mounted at /api/v1 is the endpoint /api/v1/items/{itemId}. See Endpoint handling.

  • Inbound: method, URL, headers, request and response bodies, status and timing. The request body is the one your body parser produced. The response body is what your handler passed to res.send() or res.json(), before Meteor's compression: a body written with res.write() / res.end(body) to a client that accepts compression reaches capture as compressed chunks and is not recorded, as with compression in any Express application. Bodies over maxBodyBytes (512 KB) are cut to that size and marked as truncated, and bodies over maxRedactBodyBytes (1 MB) are replaced by a placeholder.
  • Outbound: calls made with http, https and global fetch while serving a request, linked to it. See Outbound requests.
  • Sampling: requestSampleRate sends a fraction of requests; server errors are always sent.

DDP - Meteor methods and publications - travels over Meteor's WebSocket, not through WebApp, and is not recorded as requests. Static assets and the app's page are recorded like any other request; to leave them out, add exclusions in your ApiTraffic account.

Behind a proxy or load balancer

The client address recorded with each request, and used by the firewall's IP rules and rate limits, is Express's req.ip. Meteor's HTTP_FORWARDED_COUNT does not set it: tell Express how many proxies to trust, the same number, or every request is recorded as coming from your load balancer:

import { WebApp } from 'meteor/webapp';

WebApp.expressApp.set('trust proxy', 1);

Data security

Nothing here needs a code change: it is configured in your ApiTraffic account and pushed to every connected server.

  • Client-side redaction. Redaction rules are applied in your process before anything leaves it. Nothing is sent until your account's rules have loaded, and a request whose redaction cannot be completed is dropped, never sent unredacted.
  • Sensitive key masking. Credential headers are always masked. With redactSensitiveKeys (on by default), credential-shaped body keys and query parameters (password, token, secret, api_key and similar) are masked too.
  • Exclusions. Exclusions stop matching requests from being sent at all.

Firewall

The ApiTraffic firewall is mounted by mount(), and whether it runs is decided in your ApiTraffic account: nothing is loaded until a policy is live, and a policy change reaches every server without a deploy. It runs right after capture, at the head of WebApp.rawHandlers, so a request it blocks never reaches a package, a static file or your code. Blocked requests are still recorded, with the policy's status and waf.* tags.

Meteor parses no request bodies, so there the firewall sees none. If your endpoints parse bodies, mount firewall() again after your body parser, as in Where it mounts. A request is evaluated there only when it has a body the first evaluation did not see, and is never counted against rate limits twice. firewall() runs the firewall of the WebApp it is mounted in; before mount(), and under waf: false, it just calls next().

To refuse the firewall locally whatever the dashboard says, pass waf: false or set API_TRAFFIC_WAF_ENABLED=false:

mount({ waf: false });

Use the option when your change process requires that anything able to reject production traffic ships through a deploy; use the variable as an incident kill switch, which works even when ApiTraffic is unreachable. See Firewall setup.

APM

The APM bridge records database (MongoDB included), cache, queue, GraphQL, gRPC and fetch/undici spans inside each request. OpenTelemetry instruments libraries by patching them as they are loaded, so it has to start before Meteor does: Meteor loads its packages, MongoDB's driver among them, before your main module runs, so calling register() from your own code is too late for them. So it needs a preload, into the server bundle meteor build produces.

Install @apitraffic/apm, which brings the OpenTelemetry packages it needs:

meteor npm install @apitraffic/apm

Then preload the bridge, from the bundle directory, where your npm dependencies live under programs/server/npm/node_modules:

cd bundle
node -r ./programs/server/npm/node_modules/@apitraffic/meteor/dist/register.js main.js

Where you cannot change the command (Galaxy, a container's entrypoint), set NODE_OPTIONS="-r ./programs/server/npm/node_modules/@apitraffic/meteor/dist/register.js" with the bundle directory as the working directory.

@apitraffic/meteor/register is @apitraffic/node/register, re-exported so it resolves from an application that installs only this package. It reads its configuration from the API_TRAFFIC_* environment variables and never throws: if the OpenTelemetry packages are missing or fail to start, APM is skipped with a one-line reason and your server starts normally.

The preload is for applications with no other tracing. If yours already configures OpenTelemetry, skip it and add ApiTrafficSpanProcessor from @apitraffic/apm to your own provider; with Datadog or New Relic loaded the preload steps aside on its own. See Set up APM.

Tagging, tracing and spans

The helpers work anywhere a request is being handled: your handlers in WebApp.handlers, raw handlers, and any code they call. Outside a request (a Meteor method, a Meteor.startup callback, a cron job) they do nothing, and they never throw.

Tagging

tag(key: string, value: string) makes a request searchable, for example by account or user ID:

import { WebApp } from 'meteor/webapp';
import { tag } from '@apitraffic/meteor';

WebApp.handlers.get('/api/orders/:id', async (req, res) => {
  tag('accountId', req.get('x-account-id') ?? 'none');
  res.json({ id: req.params.id });
});

Keys are 1–64 characters (a letter first, then letters, digits, _, . or -); the prefixes redaction., apitraffic. and at. are reserved and dropped, and waf. is the firewall's own namespace (such a key is stored among the firewall's tags), so do not use it. Values are cut to 255 characters, and a request holds at most 32 tag keys. A tag that breaks a rule (or a missing value) is dropped, never thrown. See Tags.

Tracing

trace(content: string) is console.log for production: a timestamped note on the request (up to 255 characters, 250 per request; a longer message is dropped, not cut).

import { trace } from '@apitraffic/meteor';

trace('cart total exceeded the free-shipping threshold');

Spans

span(type, name, fn, meta?) runs fn, times it and records it on the request's waterfall, returning what fn returns; time() is the same function. startSpan(type, name, meta?) returns a handle to end() for work that does not fit one function, and addSpan() records a span you built yourself.

import express from 'express';
import { WebApp } from 'meteor/webapp';
import { span, trace } from '@apitraffic/meteor';
import { Orders } from '/imports/api/orders';

WebApp.handlers.use(express.json());

WebApp.handlers.get('/api/orders/:id', async (req, res) => {
  trace(`Loading order ${req.params.id}`);
  const order = await span('db.query', 'load order', () => Orders.findOneAsync(req.params.id));
  res.json(order);
});

type is one of db.query, redis, cache, http.out, queue, rpc, graphql or custom. getContext() and getRequestManager() expose the current request's context for advanced use; most applications never need them. See Per-request APIs.

Embed tokens

The embeddable request log (and embedded reports and dashboards) authenticate with a short-lived JWT that locks in the bucket, the filters and the request detail tabs the embed may show. It is minted on your server with an Administrator API token with no access scopes, set as API_TRAFFIC_EMBED_TOKEN (the ingest token the SDK reports with cannot mint embed tokens), and this package mints it:

import { WebApp } from 'meteor/webapp';
import { embedToken } from '@apitraffic/meteor';

// An embed token is a read credential. Meteor's HTTP handlers carry no user,
// so userFromRequest() is your own lookup (a session cookie or bearer token).
WebApp.handlers.get('/embed/token', async (req, res, next) => {
  try {
    const user = await userFromRequest(req);
    if (!user) return res.status(401).end();
    const { token, expiresAt } = await embedToken({
      // Structured: the id is escaped, so a value such as `x" OR method == "GET`
      // cannot add a condition of its own.
      filters: { tags: { customerId: String(user._id) } },
      ttl: 900,
    });
    res.json({ token, expiresAt });
  } catch (err) {
    next(err); // Express 4 (Meteor 3.0) does not catch a rejected async handler; on Express 5 this is harmless
  }
});

The host, bucket and account come from the SDK you already configured and the token from API_TRAFFIC_EMBED_TOKEN, so a call names only what is specific to this embed. Everything is optional, except reportSid or dashboardSid for a report or dashboard embed:

OptionDefaultDetails
bucketSidThe bucket the SDK reports to (request log only)The bucket the embed is scoped to. A report or dashboard keeps its own scope unless you pass one.
view'request-log''request-log', 'report' (with reportSid) or 'dashboard' (with dashboardSid).
filters{}environmentSid, criteria, streamViewSid, tags (request log) or filter, environmentSid, tags (report and dashboard) - signed into the token, so the browser cannot widen them. tags ({ customerId: id }) is written into the criteria (for a report or dashboard, the filter) safely; if you build criteria yourself, put values in double quotes through escapeCriteriaValue().
timeRange / timeRangesThe report's own / allReport and dashboard embeds: the range the embed opens with ({ relative: 'last_7d' }) and the ranges the viewer may pick.
ttl3600Token lifetime in seconds (60–86400).
theme'light''light', 'dark' or 'auto'.
tabsThe API's default setRequest detail tabs this embed may show. Request log only: the API refuses it for a report or dashboard.
features{}copyRequest, includeBodies. Request log only: the API refuses it for a report or dashboard.
accountSidFrom your SDK settingsOnly needed in a process that does not serve requests through ApiTraffic. Also read from API_TRAFFIC_ACCOUNT_SID.
token / apiHostAPI_TRAFFIC_EMBED_TOKEN / the SDK's hostOverride the credential or host for one call.

Data behind a tab you do not grant is never returned to the browser - the tabs are an access boundary, not a display setting.

This is the one call in the package that rejects rather than going quiet. A token has a single useful outcome, and it is produced inside your own await, where a failure is a 500 on that route instead of a broken embed with nothing to explain it.

API_TRAFFIC_EMBED_TOKEN is a read credential. An Administrator API token can mint embed tokens for any bucket in its account, with any filters or none, so whoever holds it can read all of the account's captured traffic. Keep it in a secret store (never in client-side code, images or a repository - and never in the public part of Meteor.settings), set it only on servers that mint embed tokens, and rotate it immediately if it may have been exposed.

Lifecycle: shutdown, flush and stats

The SDK installs no signal handlers of its own, and Meteor has no shutdown hook to follow. To deliver what was captured before the process exits (a redeploy sends SIGTERM), call shutdown() from your own handler:

// server/main.js
import { shutdown } from '@apitraffic/meteor';

process.once('SIGTERM', async () => {
  await shutdown({ flushTimeoutMs: 2000 }); // deliver what was captured, then release everything
  process.exit(0);
});

shutdown({ flushTimeoutMs }) stops capturing, delivers what is in flight and queued (waiting at most flushTimeoutMs, default 2 s; whatever is left is dropped and counted), closes the realtime connection, stops background timers and removes the http/https/fetch hooks.

  • flush({ timeoutMs }) delivers what has been captured without stopping (default timeout 2 s). Anything not delivered in time stays queued.
  • stats() returns delivery counters (pending, queued, delivered, recovered, dropped, breakerOpen, …), for a health endpoint or your own monitoring.

All three never throw.

TypeScript

The package ships its own declarations. The options are typed: ApiTrafficOptions lists every option the SDK accepts; a value of the wrong type is a compile error, and so is a misspelled key in an object literal (unlisted keys are still passed through at runtime).

import { mount, type ApiTrafficOptions } from '@apitraffic/meteor';

const options: ApiTrafficOptions = { debug: process.env.NODE_ENV !== 'production' };
mount(options);

Exported types: ApiTrafficOptions, ApiTrafficExpressHandler (what firewall() returns), MeteorWebApp (the part of WebApp mount() uses, typed structurally so the declarations need no Meteor types), WafConfigureOptions, ApmOptions, RegisterResult, SpanHandle, SpanMeta, EmbedTokenOptions and EmbedTokenResult.

Failure behaviour

The SDK is built so that it can never be the reason your application fails.

  • mount() never throws. Without a Meteor 3 WebApp to mount on it returns false and your server starts unrecorded.
  • A missing or invalid token disables telemetry and logs a clear message. Your server still starts.
  • If ApiTraffic is unreachable, requests are served normally. A short outage is absorbed by an in-memory retry queue; a longer one sheds data rather than growing without bound. See If ApiTraffic is unreachable.
  • If the realtime connection fails, you lose live configuration updates and nothing else.
  • Nothing is sent before your account's client-side redaction rules have loaded.
  • tag() and trace() never throw into your handlers, and every helper does nothing outside a request.

Want the app to refuse to boot without credentials? Check API_TRAFFIC_TOKEN and API_TRAFFIC_BUCKET yourself before you start the server. strict: true does not do it here: setup runs in the background and its error is caught.

Troubleshooting

Start with debug logging: set API_TRAFFIC_DEBUG=true (or pass debug: true) and restart. mount()'s own messages - such as there being no WebApp to mount on - are printed when API_TRAFFIC_DEBUG is set; check mount()'s return value too. A missing token is logged even without debug.

  • No requests are recorded. Check that mount() runs on the server (in server/main.js, or a module it imports), on Meteor 3, and that API_TRAFFIC_TOKEN and API_TRAFFIC_BUCKET reach the process. The setup page in ApiTraffic shows whether the SDK has connected.
  • Meteor methods and subscriptions are missing. They travel over DDP, on Meteor's WebSocket, not as HTTP requests through WebApp.
  • Body rules do not match, or request bodies are missing. Meteor parses no request bodies. Mount a body parser in WebApp.handlers, and firewall() after it.
  • Every request comes from the same address. Set WebApp.expressApp.set('trust proxy', n) (see Behind a proxy).
  • Response bodies are missing. Send API responses with res.send() or res.json(); bodies written with res.write() are compressed before capture sees them.
  • Nothing arrives, and the SDK cannot connect. Allow outbound HTTPS to ingest.apitraffic.io and api.apitraffic.io. Behind a proxy, set HTTPS_PROXY.
  • "the installed @apitraffic/waf has no … firewall". A live policy is not being enforced because an older @apitraffic/waf is installed alongside. Update it to the version @apitraffic/node depends on, or remove the duplicate.
  • APM shows no spans. The preload has to run before Meteor loads its packages, from the meteor build bundle, and @apitraffic/apm must be installed next to it. See Set up APM.

More symptoms and fixes are in the troubleshooting guide.

Sample application

The setup guide walks through a complete application. The ApiTraffic source (not the npm package) also includes a working Meteor 3 application in examples/basic. Its server/main.js calls mount({}, WebApp) with credentials from the environment, and mounts express.json() and firewall() ahead of its endpoints. Install Meteor first.

export API_TRAFFIC_TOKEN=your-ingest-token
export API_TRAFFIC_BUCKET=your-bucket-id
meteor npm install
meteor npm start

It listens on port 4000: try /api, /api/users/42 (a route parameter and a span), /api/outbound (an outbound call), /api/admin (a request answered with a 403) and / (the app's page and its static assets), then open the bucket's traffic stream in ApiTraffic.

Contributing, changelog and license

Community

Follow @apitraffic/meteor on npm to stay updated on new releases.

Follow us on our Blog and on X.

Chat with the ApiTraffic team and other members on Discord and follow our tutorials and other videos on YouTube.

ApiTraffic Discord

ApiTraffic YouTube

ApiTraffic on X

How to contribute

Here are some ways you can help improve ApiTraffic:

  • Give ApiTraffic a try and share your feedback to help make ApiTraffic even better for you. Feel free to reach out to us on Discord!
  • Join our Discord to connect with other members, share your experiences, and learn from one another.
  • Report bugs or request features by emailing support@apitraffic.io or asking on Discord.

Keywords

meteor

FAQs

Package last updated on 03 Nov 2026

Related posts