Skip to content

fix(server): make Brevo timeout configurable - #20

Merged
kamycoding merged 1 commit into
mainfrom
fix/production-proxy-email-timeout
Aug 9, 2026
Merged

fix(server): make Brevo timeout configurable#20
kamycoding merged 1 commit into
mainfrom
fix/production-proxy-email-timeout

Conversation

@kamycoding

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI lite review requested due to automatic review settings August 9, 2026 17:40
@netlify

netlify Bot commented Aug 9, 2026

Copy link
Copy Markdown

Deploy Preview for fanciful-cannoli-268c0c ready!

Name Link
🔨 Latest commit 7af789c
🔍 Latest deploy log https://app.netlify.com/projects/fanciful-cannoli-268c0c/deploys/6a78bb89e6fac400085adf30
😎 Deploy Preview https://deploy-preview-20--fanciful-cannoli-268c0c.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Makes the Brevo email-sending request timeout configurable via environment, with validation and example/test coverage to ensure safe parsing and defaults across environments.

Changes:

  • Adds BREVO_REQUEST_TIMEOUT_MS to server environment schema with coercion + default.
  • Updates sendContactEmail to default its timeout from env.BREVO_REQUEST_TIMEOUT_MS.
  • Extends integration tests and .env.example to cover configured/invalid/omitted timeout behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
server/test/contact.integration.test.ts Adds coverage for parsing, rejecting, and defaulting the Brevo timeout env var.
server/src/services/email.service.ts Uses the validated env-configured timeout as the default for Brevo requests.
server/src/config/env.ts Introduces BREVO_REQUEST_TIMEOUT_MS validation + exports validateEnvironment for reuse in tests.
server/.env.example Documents the new timeout setting with a default example value.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread server/src/config/env.ts
Comment on lines 10 to +13
BREVO_API_KEY: z.string().min(1, 'BREVO_API_KEY is required.'),

BREVO_REQUEST_TIMEOUT_MS: z.coerce.number().int().positive().default(15_000),

@kamycoding
kamycoding merged commit 0ee0cf2 into main Aug 9, 2026
5 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7af789c490

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/src/config/env.ts

BREVO_API_KEY: z.string().min(1, 'BREVO_API_KEY is required.'),

BREVO_REQUEST_TIMEOUT_MS: z.coerce.number().int().positive().default(15_000),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject timeouts above Node's timer limit

When BREVO_REQUEST_TIMEOUT_MS is 2147483648 or larger, this schema accepts it, but Node 24 clamps an overflowing setTimeout delay to 1 ms. In the Docker runtime targeted here, such a configured value therefore aborts essentially every Brevo request immediately instead of providing a longer timeout. Add an upper bound of 2147483647 or explicitly cap the parsed value.

Useful? React with 👍 / 👎.

@kamycoding
kamycoding deleted the fix/production-proxy-email-timeout branch August 9, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants