mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[PR #5997] [CLOSED] Fix JSON parsing errors #5456
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5456
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5997
Author: @tembo[bot]
Created: 3/16/2026
Status: ❌ Closed
Base:
refactor/workspaces← Head:tembo/refactor-workspace-abstractions📝 Commits (2)
cdf371bfix(new-workspace): add JSON parse error handling in teams provider and clean test provider code8e33a5cfix(teams): add safe JSON parsing for environment variables and log errors📊 Changes
2 files changed (+91 additions, -27 deletions)
View changed files
📝
packages/hoppscotch-common/src/services/new-workspace/providers/teams.workspace.ts(+89 -23)📝
packages/hoppscotch-common/src/services/new-workspace/providers/test.workspace.ts(+2 -4)📄 Description
Summary
Prevents crashes in the Teams workspace provider by safely parsing backend JSON for collections, requests, and environments. Malformed payloads are logged and skipped/defaulted instead of throwing.
What's changed
try/catcharoundJSON.parse(collection.data)for collection properties inteams.workspace.tsflatMap+ guardedJSON.parse(request.request)so malformed requests are skippedJSON.parse(environment.variables)sites (create/duplicate/update/import + environments view) and defaulted variables to[]on parse failureNotes to reviewers
This makes the UI resilient to malformed JSON coming from the backend by ensuring parse errors don't bubble into runtime crashes. Parse failures are logged to console for debugging.
Summary by cubic
Add safe JSON parsing across the Teams workspace provider to prevent crashes from malformed backend JSON. Guards are added for collection properties, requests, and environment variables; invalid data is skipped and errors are logged. Minor cleanup in the test provider.
Bug Fixes
JSON.parsefor collection properties, request payloads, and team environment variables; log parse failures.flatMapto skip malformed requests while preserving order; default env vars to[]on failure.Refactors
timestampand computed name; use "Workspace A".registerWorkspaceProvider.Written for commit
8e33a5cd92. Summary will update on new commits.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.