chore(deps): #64 drop unused @vercel/remote-nx#70
Conversation
Root vercel.json was a Vite SPA rewrite (\`/(.*) → /index.html\`) that would break Next.js deploys by routing every path into a nonexistent index.html. The Next App Router handles routing itself — no rewrite needed at the Vercel layer. Per the Vercel monorepo guide and the roadmap, web and api will each become their own Vercel project with Root Directory apps/web and apps/api respectively. Root-level vercel.json would apply to both and cannot express per-app config coherently, so it stays removed. - nx affected -t lint test build --exclude web-e2e green - nx.json sharedGlobals previously referenced .circleci and .github/workflows/ci.yml, not vercel.json — no cache invalidation to worry about Refs #62
Closes the server-only half of #3 by routing every public-data-portal call through a Next Route Handler that reads the key from process.env.DATA_GO_KR_SERVICE_KEY (no NEXT_PUBLIC_ prefix). The browser bundle no longer carries the key. apps/web/app/api/data-go-kr/[...path]/route.ts (new): - Catch-all GET handler that mirrors the upstream http://apis.data.go.kr/1543061/abandonmentPublicSrvc/<path> structure - Reads search params from the incoming request, injects serviceKey and _type=json server-side, then forwards via fetch - Passes through status/content-type, returns 500 if the env var is missing, 502 if the upstream fetch throws apps/web/src/new-api/service.ts: - baseURL switched to '/api/data-go-kr' (relative path, no host) - Drops the serviceKey query param entirely — the proxy handles it - Drops the import.meta / process.env env-check code - Same export surface (getAPI, serviceAPI) so all 5 callers under new-api/{animalInfo,kind,sigungu,shelter,sido} keep working unchanged apps/web/.env.example: - NEXT_PUBLIC_DATA_GO_KR_SERVICE_KEY → DATA_GO_KR_SERVICE_KEY - Comment updated: server-only, read by the Route Handler Build output: ○ / ○ /_not-found ƒ /api/data-go-kr/[...path] ← new dynamic route ○ /like ○ /search - nx affected -t lint test build --exclude web-e2e green Refs #63
The public-data-portal endpoint moved to v2 with a renamed base path and per-resource _v2 suffixes. Update the proxy and the consumers in the same PR so the Route Handler delivered in the previous commit keeps working end-to-end. Route Handler upstream URL: - http://apis.data.go.kr/1543061/abandonmentPublicSrvc + https://apis.data.go.kr/1543061/abandonmentPublicService_v2 (now also HTTPS, matching the v2 spec at data.go.kr/data/15098931) new-api path constants (all five callers): - /abandonmentPublic → /abandonmentPublic_v2 - /sido → /sido_v2 - /sigungu → /sigungu_v2 - /kind → /kind_v2 - /shelter → /shelter_v2 shared-types AnimalInfo: - popfile (single Image URL) → popfile1 (required) plus optional popfile2..popfile8. The v2 schema returns up to 8 image URLs per rescue notice; we only render the first today, but the optional fields are typed for the gallery work in #18 e2e / future ports. apps/web AnimalCard.tsx: - item.popfile → item.popfile1 - nx affected -t lint test build --exclude web-e2e green Refs #63
@vercel/remote-nx wires Nx Remote Cache into a Vercel-hosted endpoint via tasksRunnerOptions in nx.json. Our nx.json has never had any tasksRunnerOptions wired to it (we now use the standard Nx Cloud runner via nxCloudAccessToken), so the dependency was dead weight. - grep '@vercel/remote-nx' apps libs → zero source references - nx affected -t lint test build --exclude web-e2e green (10/10 cache) Refs #64
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's GuideMigrates the web app to use the official v2 public-data-portal API via a Next.js route handler proxy (hiding the API key from the browser), updates shared response types and API clients accordingly, adjusts image field usage, and drops the unused @vercel/remote-nx dependency and related Vercel config. Sequence diagram for proxied v2 public-data-portal requestssequenceDiagram
actor Browser
participant AnimalSearchUI
participant NewAPIClient as NewAPI_client_functions
participant NextRoute as Next_data_go_kr_route
participant PublicAPI as Public_data_portal_v2
Browser->>AnimalSearchUI: Search/Filter interaction
AnimalSearchUI->>NewAPIClient: getAnimalInfo(props)
NewAPIClient->>NextRoute: GET /api/data-go-kr/abandonmentPublic_v2?query
NextRoute->>NextRoute: Read DATA_GO_KR_SERVICE_KEY
NextRoute->>PublicAPI: GET /abandonmentPublicService_v2/abandonmentPublic_v2?query&serviceKey&_type=json
PublicAPI-->>NextRoute: JSON response
NextRoute-->>NewAPIClient: Proxied JSON response
NewAPIClient-->>AnimalSearchUI: APIResponse<AnimalInfo>
AnimalSearchUI-->>Browser: Render AnimalCard with item.popfile1
ER diagram for updated APIResponse image fieldserDiagram
APIResponse {
string response_header_resultCode
string response_header_resultMsg
number response_body_items_totalCount
}
APIItem {
string noticeNo
string noticeSdt
string noticeEdt
string popfile1
string popfile2
string popfile3
string popfile4
string popfile5
string popfile6
string popfile7
string popfile8
string processState
string sexCd
string neuterYn
}
APIResponse ||--o{ APIItem : contains_items
Class diagram for updated web API client and route handlerclassDiagram
class ServiceAPIClient {
- string baseURL
+ getAPI(props, path) Promise
}
class AnimalInfoAPI {
+ getAnimalInfo(props) Promise
}
class KindAPI {
+ getKind(props) Promise
}
class ShelterAPI {
+ getShelter(props) Promise
}
class SidoAPI {
+ getSido(props) Promise
}
class SigunguAPI {
+ getSigungu(props) Promise
}
class DataGoKrRouteHandler {
- string UPSTREAM_BASE
+ GET(request, context) Promise
}
ServiceAPIClient <|.. AnimalInfoAPI
ServiceAPIClient <|.. KindAPI
ServiceAPIClient <|.. ShelterAPI
ServiceAPIClient <|.. SidoAPI
ServiceAPIClient <|.. SigunguAPI
DataGoKrRouteHandler --> ServiceAPIClient : serves_requests_for
AnimalInfoAPI --> DataGoKrRouteHandler : calls
KindAPI --> DataGoKrRouteHandler : calls
ShelterAPI --> DataGoKrRouteHandler : calls
SidoAPI --> DataGoKrRouteHandler : calls
SigunguAPI --> DataGoKrRouteHandler : calls
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
View your CI Pipeline Execution ↗ for commit b610789
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In the Next route handler,
context.paramsis not a promise in the app router; you can remove thePromisetype andawaitand type it as{ params: { path: string[] } }to match Next’s handler signature. - The new
popfile1–popfile8fields are all modeled on the same interface entry that used to be a singlepopfile; if the upstream API doesn’t guarantee at least one image, consider markingpopfile1as optional and/or handling a missing image inAnimalCardto avoid runtime issues. - In the proxy route, you might want to propagate the original request’s
signaltofetch(e.g.,fetch(upstreamUrl, { signal: request.signal, ... })) so upstream requests are aborted when the client disconnects.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the Next route handler, `context.params` is not a promise in the app router; you can remove the `Promise` type and `await` and type it as `{ params: { path: string[] } }` to match Next’s handler signature.
- The new `popfile1`–`popfile8` fields are all modeled on the same interface entry that used to be a single `popfile`; if the upstream API doesn’t guarantee at least one image, consider marking `popfile1` as optional and/or handling a missing image in `AnimalCard` to avoid runtime issues.
- In the proxy route, you might want to propagate the original request’s `signal` to `fetch` (e.g., `fetch(upstreamUrl, { signal: request.signal, ... })`) so upstream requests are aborted when the client disconnects.
## Individual Comments
### Comment 1
<location path="apps/web/app/api/data-go-kr/[...path]/route.ts" line_range="6-8" />
<code_context>
+const UPSTREAM_BASE =
+ 'https://apis.data.go.kr/1543061/abandonmentPublicService_v2';
+
+export async function GET(
+ request: NextRequest,
+ context: { params: Promise<{ path: string[] }> }
+) {
+ const serviceKey = process.env.DATA_GO_KR_SERVICE_KEY;
</code_context>
<issue_to_address>
**suggestion:** The `context.params` type and `await` usage are inconsistent with Next.js route handler conventions.
`context.params` should be typed as a plain object, not a `Promise`. Using `Promise<{ path: string[] }>` and `await` here misrepresents the actual type and can mislead TypeScript and future readers. Please update the signature to `context: { params: { path: string[] } }` and destructure with `const { path } = context.params;`.
Suggested implementation:
```typescript
export async function GET(
request: NextRequest,
context: { params: { path: string[] } }
) {
```
```typescript
const { path } = context.params;
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| export async function GET( | ||
| request: NextRequest, | ||
| context: { params: Promise<{ path: string[] }> } |
There was a problem hiding this comment.
suggestion: The context.params type and await usage are inconsistent with Next.js route handler conventions.
context.params should be typed as a plain object, not a Promise. Using Promise<{ path: string[] }> and await here misrepresents the actual type and can mislead TypeScript and future readers. Please update the signature to context: { params: { path: string[] } } and destructure with const { path } = context.params;.
Suggested implementation:
export async function GET(
request: NextRequest,
context: { params: { path: string[] } }
) { const { path } = context.params;
Summary
Stacked on #69.
@vercel/remote-nxwires Nx Remote Cache into a Vercel-hosted endpoint viatasksRunnerOptionsinnx.json. This repo has never had anytasksRunnerOptionswired to it (we use the standard Nx Cloud runner vianxCloudAccessToken), so the dep is dead weight.Closes #64.
Test plan
grep '@vercel/remote-nx' apps libs→ zero source referencesnpx nx affected -t lint test build --exclude web-e2egreen (10/10 cache hits)🤖 Generated with Claude Code
Summary by Sourcery
Route public-data-portal traffic through a Next.js API proxy using a server-only key, migrate clients to the v2 abandonment API, and drop unused Vercel/Nx integration config and dependency.
New Features:
Bug Fixes:
Enhancements:
Build:
Deployment: