Files
GibSend/.github/workflows/test-web.yml
T
KM Koushik 04d0f4b123 feat: support standard AWS env vars and default credential chain (#401)
* feat: support standard AWS env vars and default credential chain

Replace non-standard AWS_ACCESS_KEY / AWS_SECRET_KEY with the AWS-standard
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY. The old names are kept as
fallbacks in the runtimeEnv for backward compatibility.

Both vars are now optional. When omitted, the credentials object is not
passed to SESv2Client, STSClient, or SNSClient — the AWS SDK then falls
back to its default provider chain (IAM roles, ECS task roles, instance
profiles, etc.), which is the recommended approach for cloud-native deployments.

Closes #316

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* refactor: extract shared getAwsCredentialOptions helper and add partial-config guard

- Move the credential spread logic into a single credentials.ts helper
  so SESv2Client, STSClient, and SNSClient all share one implementation
- Throw a clear error if only one of AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY
  is set, preventing silent fallback to the default provider chain with a
  half-configured environment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: align AWS env vars in docker and docs

* fix: use alias import for AWS credentials helper

---------

Co-authored-by: purva <purvahk08@gmail.com>
Co-authored-by: Purva Kandalgaonkar <136103488+purva-8@users.noreply.github.com>
2026-05-17 21:23:28 +10:00

87 lines
2.0 KiB
YAML

name: Web Tests
on:
pull_request:
paths:
- "apps/web/**"
push:
branches:
- main
paths:
- "apps/web/**"
jobs:
web-tests:
runs-on: ubuntu-latest
env:
NODE_ENV: test
NEXTAUTH_URL: http://localhost:3000
NEXTAUTH_SECRET: test-secret
DATABASE_URL: postgresql://usesend:password@127.0.0.1:5432/usesend_test
REDIS_URL: redis://127.0.0.1:6379/15
AWS_ACCESS_KEY_ID: test-access-key
AWS_SECRET_ACCESS_KEY: test-secret-key
AWS_DEFAULT_REGION: us-east-1
NEXT_PUBLIC_IS_CLOUD: "true"
API_RATE_LIMIT: "2"
AUTH_EMAIL_RATE_LIMIT: "5"
RUN_INTEGRATION: "true"
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: usesend
POSTGRES_PASSWORD: password
POSTGRES_DB: usesend_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U usesend -d usesend_test"
--health-interval 5s
--health-timeout 5s
--health-retries 20
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 20
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 8.9.0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate Prisma client
run: pnpm --filter=web db:generate
- name: Prepare test database schema
run: pnpm --filter=web test:integration:prepare
- name: Run unit tests
run: pnpm --filter=web test:unit
- name: Run tRPC tests
run: pnpm --filter=web test:trpc
- name: Run API tests
run: pnpm --filter=web test:api
- name: Run integration tests
run: pnpm --filter=web test:integration