Skip to content

feat(example): Add backend API server to Weather example#405

Open
sergical wants to merge 1 commit intogetsentry:mainfrom
sergical:weather-example-add-backend
Open

feat(example): Add backend API server to Weather example#405
sergical wants to merge 1 commit intogetsentry:mainfrom
sergical:weather-example-add-backend

Conversation

@sergical
Copy link
Copy Markdown
Member

@sergical sergical commented May 8, 2026

Summary

  • Move iOS app sources into app/ subdirectory for cleaner project structure
  • Add a Hono/Node.js backend (backend/) that serves mock weather data for all three API endpoints (default locations, search, weather report)
  • Update config and README to reflect the new layout

Test plan

  • cd backend && npm install && npm run dev starts the API server on port 3001
  • curl http://localhost:3001/v1/locations/default returns default locations
  • curl http://localhost:3001/v1/locations/search?query=paris returns search results
  • curl http://localhost:3001/v1/weather/loc-current-san-francisco returns weather data
  • iOS app builds and runs from app/Weather.xcodeproj
  • Mock mode still works via --mock-weather-api launch arg

🤖 Generated with Claude Code

Comment thread example_projects/Weather/backend/src/index.ts
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit af15be2. Configure here.

...detail,
precipChance: Math.round(detail.precipChance),
};
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing "rainy" scenario crashes weather endpoint

High Severity

The precipitationDetail map is missing the "rainy" scenario, but scenarioByLocationID maps six locations (Portland, London, Berlin, Stockholm, Vancouver, Toronto) to "rainy". When any of these locations is requested via /v1/weather/:locationID, getPrecipitationDetail uses a non-null assertion (!) on precipitationDetail[scenario], which will be undefined for "rainy". This causes a runtime TypeError on detail.precipChance, crashing the request. Portland is a default location, so this will be hit immediately.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit af15be2. Configure here.

Move iOS app sources into app/ subdirectory and add a Hono/Node.js
backend that serves mock weather data for the three API endpoints
(default locations, search, weather report by location).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sergical sergical force-pushed the weather-example-add-backend branch from af15be2 to da82550 Compare May 8, 2026 16:39
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 8, 2026

Open in StackBlitz

npm i https://pkg.pr.new/xcodebuildmcp@405

commit: da82550

Comment on lines 400 to +403
ENABLE_PREVIEWS = YES;
ENABLE_USER_SELECTED_FILES = readonly;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Info.plist;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The project has conflicting build settings for the Info.plist. GENERATE_INFOPLIST_FILE is YES while also specifying a custom INFOPLIST_FILE, which will likely be ignored.
Severity: HIGH

Suggested Fix

To ensure the custom Info.plist is used, set GENERATE_INFOPLIST_FILE = NO; in the build settings for both Debug and Release configurations. This resolves the conflict and allows the NSAllowsLocalNetworking key from your custom Info.plist to be included in the final app bundle.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: example_projects/Weather/app/Weather.xcodeproj/project.pbxproj#L400-L403

Potential issue: The Xcode project is configured with conflicting build settings for
handling the `Info.plist` file. Both `GENERATE_INFOPLIST_FILE` is set to `YES` and a
custom `INFOPLIST_FILE` is specified. These settings are mutually exclusive. Xcode will
likely prioritize auto-generating the `Info.plist`, causing the custom file and its
`NSAllowsLocalNetworking` key to be ignored. Without this key, App Transport Security
(ATS) will block HTTP requests to the local development server at
`http://localhost:3001`, resulting in network failures at runtime when the app tries to
fetch data.

Also affects:

  • example_projects/Weather/app/Weather.xcodeproj/project.pbxproj:445~448

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.

1 participant