feat(example): Add backend API server to Weather example#405
feat(example): Add backend API server to Weather example#405sergical wants to merge 1 commit intogetsentry:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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), | ||
| }; | ||
| } |
There was a problem hiding this comment.
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)
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>
af15be2 to
da82550
Compare
commit: |
| ENABLE_PREVIEWS = YES; | ||
| ENABLE_USER_SELECTED_FILES = readonly; | ||
| GENERATE_INFOPLIST_FILE = YES; | ||
| INFOPLIST_FILE = Info.plist; |
There was a problem hiding this comment.
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


Summary
app/subdirectory for cleaner project structurebackend/) that serves mock weather data for all three API endpoints (default locations, search, weather report)Test plan
cd backend && npm install && npm run devstarts the API server on port 3001curl http://localhost:3001/v1/locations/defaultreturns default locationscurl http://localhost:3001/v1/locations/search?query=parisreturns search resultscurl http://localhost:3001/v1/weather/loc-current-san-franciscoreturns weather dataapp/Weather.xcodeproj--mock-weather-apilaunch arg🤖 Generated with Claude Code