Skip to content

fix: make computeVendorKey async for Server Actions compatibility#671

Closed
github-actions[bot] wants to merge 1 commit intofeat/provider-vendor-recluster-host-portfrom
claude-fix-pr-670-21436434344
Closed

fix: make computeVendorKey async for Server Actions compatibility#671
github-actions[bot] wants to merge 1 commit intofeat/provider-vendor-recluster-host-portfrom
claude-fix-pr-670-21436434344

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Jan 28, 2026

CI Auto-Fix

Original PR: #670
Failed CI Run: PR Build Check

Problem

The Docker Build Test failed with:

Error: Turbopack build failed with 1 errors:
./src/repository/provider-endpoints.ts:112:17
Server Actions must be async functions.

Next.js 16 with Turbopack requires all exported functions in "use server" files to be async. The computeVendorKey function was synchronous but exported from a Server Actions module.

Fixes Applied

File Fix Type
src/repository/provider-endpoints.ts Made computeVendorKey async, return Promise<string | null> Server Actions compliance
src/repository/provider-endpoints.ts Added await to call sites (lines 262, 382) Async call update
src/actions/providers.ts Added await to call site (line 3624) Async call update
tests/unit/repository/provider-endpoints-vendor-key.test.ts Updated all tests to use async/await Test update

Verification

The fix is minimal and safe:

  • The function body remains unchanged (pure computation)
  • Making it async just wraps the return value in a Promise
  • All call sites already exist in async functions, so adding await is straightforward
  • No logic changes were made

Auto-generated by Claude AI

Greptile Overview

Greptile Summary

This PR fixes a Next.js 16 Turbopack compilation error by making the computeVendorKey function async to comply with Server Actions requirements.

Key Changes:

  • Made computeVendorKey async and changed return type from string | null to Promise<string | null>
  • Added await to all 3 call sites in production code (lines 262, 382 in provider-endpoints.ts and line 3624 in providers.ts)
  • Updated all 27 unit tests to use async/await pattern

Analysis:
The fix is minimal and correct. The function body remains completely unchanged - it still performs the same synchronous computation. Making it async simply wraps the return value in a resolved Promise, which is required by Next.js 16 when functions are exported from a "use server" module. All calling functions were already async, so adding await was straightforward with no cascade effects.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The changes are purely mechanical to satisfy Next.js 16 Server Actions requirements. The function logic is completely unchanged, only wrapped in a Promise. All call sites were updated correctly with await, and comprehensive test coverage was maintained.
  • No files require special attention

Important Files Changed

Filename Overview
src/repository/provider-endpoints.ts Made computeVendorKey async and added await to 2 call sites for Server Actions compliance
src/actions/providers.ts Added await to computeVendorKey call in reclusterProviderVendors
tests/unit/repository/provider-endpoints-vendor-key.test.ts Updated all 27 test cases to use async/await pattern for new function signature

Sequence Diagram

sequenceDiagram
    participant CallerFunc as Calling Function
    participant VendorKey as computeVendorKey (now async)
    participant Normalize as Normalization Helpers
    
    Note over VendorKey: Changed to async for<br/>Next.js 16 Server Actions
    
    CallerFunc->>VendorKey: await computeVendorKey(params)
    
    alt Has websiteUrl
        VendorKey->>Normalize: normalizeWebsiteDomainFromUrl
        Normalize-->>VendorKey: returns domain name
    else No websiteUrl
        VendorKey->>Normalize: normalizeHostWithPort
        Normalize-->>VendorKey: returns address and port
    end
    
    VendorKey-->>CallerFunc: Promise resolves to result
    
    Note over VendorKey: Logic unchanged<br/>Signature updated only
Loading

Next.js 16 with Turbopack requires all exported functions in "use server"
files to be async. The computeVendorKey function was synchronous but
exported from a Server Actions module, causing the build to fail.

Changes:
- Make computeVendorKey async and return Promise<string | null>
- Update all call sites to await the function
- Update tests to use async/await pattern

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Comment @coderabbitai help to get the list of available commands and usage tips.

@ding113 ding113 closed this Jan 28, 2026
@github-project-automation github-project-automation bot moved this from Backlog to Done in Claude Code Hub Roadmap Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant