Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Description

We had an issue where the NEXT_PUBLIC_SOCKET_URL was not being picked up properly and this is because t3-oss was not transpiled in the standalone build, and the runtime envvars were undefined and led to fallbacks. This worked if you didn't have a remote socket server url, but didn't used to work if you had the socket server running elsewhere with a standalone build.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Tested manually with a script to ensure that we were grabbing the correct socket url.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally and in CI (bun run test)
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • I have updated version numbers as needed (if needed)
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Security Considerations:

  • My changes do not introduce any new security vulnerabilities
  • I have considered the security implications of my changes

@vercel
Copy link

vercel bot commented Jul 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sim ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 21, 2025 5:06pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Skipped (Inspect) Jul 21, 2025 5:06pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR addresses a critical environment variable handling issue in the Next.js configuration. The change adds two T3 (t3-oss) packages (@t3-oss/env-nextjs and @t3-oss/env-core) to the transpilePackages array in next.config.ts. This ensures that the NEXT_PUBLIC_SOCKET_URL environment variable is properly processed in standalone builds, particularly when using a remote socket server.

The fix is especially important for the application's socket functionality and Content-Security-Policy header configuration, where both HTTP and WSS variants of the socket URL need to be correctly handled. Without this change, runtime environment variables were undefined in standalone builds when using remote socket servers, leading to unintended fallback values.

Confidence Score: 5/5

  1. This PR is very safe to merge as it fixes a clear configuration issue without introducing new risks.
  2. The change is minimal, well-understood, and fixes a specific environment variable processing issue that has been manually verified.
  3. The next.config.ts file needs careful review to ensure the transpilePackages array is correctly updated.

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@delve-auditor
Copy link

delve-auditor bot commented Jul 21, 2025

No security or compliance issues detected. Reviewed everything up to 26dd9d4.

Security Overview
  • 🔎 Scanned files: 1 changed file(s)
Detected Code Changes
Change Type Relevant files
Configuration changes ► next.config.ts
    Add t3 packages to transpilePackages for environment variable support

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@waleedlatif1 waleedlatif1 merged commit d919073 into staging Jul 21, 2025
6 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/socket-url branch July 21, 2025 17:18
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
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