Skip to content

InvalidFileTypeError not mapped in GraphQL error-map + HEIC not in allowed content types #298

@islandbitcoin

Description

@islandbitcoin

Bug Report

Summary

Two related bugs in the account upgrade ID document upload flow:

Bug 1 — InvalidFileTypeError not mapped in error-map.ts

src/graphql/error-map.ts has no case for InvalidFileTypeError, so it falls through to assertUnreachable() which throws:

Error: This should never compile with InvalidFileTypeError

This surfaces to the mobile client as a cryptic ApolloError instead of a user-friendly validation message.

File: src/graphql/error-map.ts
Fix: Add a case for InvalidFileTypeError that returns a ValidationInternalError with the existing descriptive message from the error class (Invalid file type: X. Allowed: image/jpeg, image/png, image/webp).

Bug 2 — image/heic not in ALLOWED_CONTENT_TYPES

iOS devices (and the iOS simulator via react-native-image-picker) return image/heic as the content type for photos. The backend only accepts ["image/jpeg", "image/png", "image/webp"], rejecting all HEIC uploads.

File: src/services/storage/index.ts line 16
Fix: Add "image/heic" to ALLOWED_CONTENT_TYPES.

Impact

The account upgrade flow ID document upload is completely broken on iOS — every photo library selection fails with the cryptic error above.

Reproduction

  1. Build feat/business-account branch on iOS simulator
  2. Go through account upgrade flow to Pro/Merchant
  3. Attempt to upload an ID document from photo library
  4. ApolloError: This should never compile with InvalidFileTypeError

Related

  • PR #400 (feat/business-account) — account upgrade flow
  • src/services/storage/errors.tsInvalidFileTypeError class definition
  • src/services/storage/index.tsisValidContentType() function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions