Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Bug] Power Apps Android app: binary data between a code app and the host breaks — Dataverse image upload fails ("o.arrayBuffer is not a function"), picked files can't be read (FileReader {"code":2}), downloaded images render gray / truncated

Đang mở
#503 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
databases, react, typescript, vite

Hướng nghiên cứu

Start by tracing the generated service methods uploadFileToRecord, downloadImageFromRecord, and downloadFileFromRecord in the repository; the issue does not name their source files or tests. Compare how they handle binary data in the Android host and browser, then reproduce the upload, picked file read, and image download failures in the Power Apps Android app. Done means standard file APIs and the service methods work with complete image bytes on Android as they do in the browser.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Describe the bug

In the Power Apps Android app, a published code app can't reliably exchange binary data with the host, while the same app works fine in the browser (Edge / Chrome on desktop, apps.powerapps.com/play/...):

  1. Upload of an image to a Dataverse image column with the generated service (<Table>Service.upload(id, '<imagecolumn>', file) → uploadFileToRecord) fails with o.arrayBuffer is not a function.
  2. Reading a picked file (<input type="file" accept="image/*">, the file arrives as resized-<guid>.jpg) with FileReader fails with an error object that only contains {"code":2} — both right after picking and later. {"code":2} looks like the SECURITY_ERR of a Cordova-style FileError, not a browser DOMException.
  3. Download of an image with the generated service (<Table>Service.downloadImage(id, '<imagecolumn>', true) → downloadImageFromRecord) returns data that renders as a gray image with only the top rows of the photo (a truncated / corrupted JPEG). The image stored in Dataverse is complete (verified via the Web API: x-ms-file-size = the uploaded size, the full image opens correctly in the browser version of the same app).

The browser version of the same app (same environment, same records) uploads, reads and shows the images correctly.

Steps to Reproduce

  1. Create a code app (@microsoft/power-apps 1.5.0, pa CLI) with a Dataverse table that has an image column (full image stored: CanStoreFullImage = true) as a data source.
  2. Add an <input type="file" accept="image/*">; on change, upload the file with the generated service: await <Table>Service.upload(recordId, '<imagecolumn>', file).
  3. Show an image with await <Table>Service.downloadImage(recordId, '<imagecolumn>', true) → data: URL (blob: URLs are blocked by the CSP) → <img>.
  4. Push the app, open it in the Power Apps Android app (Play Store), pick a photo from the device and upload it; open a record with an image.

Expected behavior

  • <Table>Service.upload(...) with a picked File works in the Android app as it does in the browser.
  • A picked file can be read with the standard web APIs (FileReader, Blob.arrayBuffer()).
  • <Table>Service.downloadImage(...) returns the complete image bytes (a Uint8Array), as in the browser.

Actual behavior

What Browser Power Apps Android app
Service.upload(id, column, file) works fails: o.arrayBuffer is not a function
FileReader.readAsDataURL(file) on the picked file works fails: error object {"code":2} (also right after picking)
Service.downloadImage(id, column, true) → data: URL correct image gray image, only the top rows visible (corrupted / truncated bytes)
Image stored in Dataverse after a browser upload complete complete (same record)

What we tried (in order)

# Approach Result in the Android app
1 <Table>Service.upload(id, column, file) (binary upload via the SDK) ❌ o.arrayBuffer is not a function
2 Read the file at save time with FileReader → base64 → save in the record (create with "<imagecolumn>": "<base64>") ❌ FileReader error {"code":2}
3 Same, but read the file immediately after picking ❌ {"code":2} right after picking
4 Current workaround (works): try every way to get the bytes in turn — file.arrayBuffer(), new Response(file).arrayBuffer(), fetch(URL.createObjectURL(file)), a FileReader taken from a fresh same-origin about:blank iframe, window.FileReader — then re-encode (canvas → JPEG), convert the bytes to base64 without FileReader, and save the image as base64 in the record's create payload ("<imagecolumn>": "<base64>") ✅ upload works; full image stored (verified via the Web API)
5 Download: downloadImage(id, column, true); accept every data shape (Uint8Array, ArrayBuffer, number array, base64 / binary string), check the JPEG end marker, fall back to the thumbnail from the query ❌ still gray: the bytes pass the checks but are corrupted

Notes:

  • Creating records also showed "An unknown error occurred" in the Android app while Dataverse did save the row (the create reads the record back; related: #444). Workaround: set the primary key in the app and check with a list query after an error.
  • The host rejected one call with a plain object (shown as [object Object]), not an Error.

Questions for the team

Our workaround (4) works, but it bypasses the SDK's upload and depends on how the Android app exposes picked files. We would prefer the standard approaches to work in the Android app as they do in the browser:

  1. Can <Table>Service.upload / uploadFileToRecord accept a picked File in the Android app (the host seems to call arrayBuffer() on an object that doesn't have it)?
  2. Can a file picked in a code app be read with the standard FileReader / Blob.arrayBuffer() in the Android app? Is window.FileReader / File replaced inside the code app's frame (the {"code":2} error looks like Cordova's FileError.SECURITY_ERR)?
  3. Can <Table>Service.downloadImage (and downloadFileFromRecord) return the complete binary data in the Android app? It looks like the bytes are converted to text on the way (the JPEG header survives, the rest doesn't).
  4. Is there a recommended way to upload / download images and files from a code app on mobile until this is fixed?

Screenshots or Error Messages

  • New record form, Android app: o.arrayBuffer is not a function (screenshot 1)
Image
  • Detail view, Android app: the image renders gray, only the top rows visible; same in the enlarged view (screenshots 2, 3)
  • The image could not be read: {"code":2} (FileReader on the picked file)
Image Image

Environment information

  • Framework, build tool or relevant package used: React 19, Vite 7, TypeScript 5.9, @microsoft/power-apps 1.5.0, @microsoft/power-apps-vite 1.0.2, pa CLI 1.3.0
  • Any connection/components: Dataverse (native data source, generated services), image column with full image stored; Office 365 Outlook / Users connectors (not involved)
  • Device: Android phone, Power Apps app from the Play Store (version: 3.26094.5 ), Android version 16
  • Browser comparison: Edge / Chrome on Windows — everything works

Additional context

  • The app is pushed with pa app push and shipped in a solution; the same behaviour in both.
  • Related Android issues: #444 (single-record reads hang / fail in the Android app), #364 (100vh on Android).
Ngôn ngữ chính
TypeScript
Star
516
Fork
145
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
23

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/PowerAppsCodeApps

Tất cả issue của microsoft/PowerAppsCodeApps

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.