Skip to content

πŸ› Bug Report: Unhandled API Response in ActivityFeedΒ #641

@annrose2277-glitch

Description

@annrose2277-glitch

πŸ“œ Description

// ❌ PROBLEMATIC CODE
const res = await fetch(https://api.github.com/users/${username}/events);
const data = await res.json();
setEvents(data); // No validation - could be error response

Issue: No HTTP status validation. If the response is an error, data will contain an error object with message field, not an events array.

Impact: Runtime errors when trying to iterate over non-array data, application crashes.

Recommended Fix: Check res.ok before parsing JSON and validating response structure.

What browsers are you seeing the problem on?

No response

πŸ“ƒ Relevant Screenshots (Links)

No response

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions