[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
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- databases, react, typescript, vite
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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/...):
- Upload of an image to a Dataverse image column with the generated service (
<Table>Service.upload(id, '<imagecolumn>', file)→uploadFileToRecord) fails witho.arrayBuffer is not a function. - Reading a picked file (
<input type="file" accept="image/*">, the file arrives asresized-<guid>.jpg) withFileReaderfails with an error object that only contains{"code":2}— both right after picking and later.{"code":2}looks like theSECURITY_ERRof a Cordova-styleFileError, not a browserDOMException. - 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
- Create a code app (
@microsoft/power-apps1.5.0,paCLI) with a Dataverse table that has an image column (full image stored:CanStoreFullImage= true) as a data source. - Add an
<input type="file" accept="image/*">; on change, upload the file with the generated service:await <Table>Service.upload(recordId, '<imagecolumn>', file). - Show an image with
await <Table>Service.downloadImage(recordId, '<imagecolumn>', true)→data:URL (blob: URLs are blocked by the CSP) →<img>. - 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 pickedFileworks 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 (aUint8Array), 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 anError.
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:
- Can
<Table>Service.upload/uploadFileToRecordaccept a pickedFilein the Android app (the host seems to callarrayBuffer()on an object that doesn't have it)? - Can a file picked in a code app be read with the standard
FileReader/Blob.arrayBuffer()in the Android app? Iswindow.FileReader/Filereplaced inside the code app's frame (the{"code":2}error looks like Cordova'sFileError.SECURITY_ERR)? - Can
<Table>Service.downloadImage(anddownloadFileFromRecord) 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). - 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)
- 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)
Environment information
- Framework, build tool or relevant package used: React 19, Vite 7, TypeScript 5.9,
@microsoft/power-apps1.5.0,@microsoft/power-apps-vite1.0.2,paCLI 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 pushand 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).
- 主要言語
- TypeScript
- スター
- 516
- フォーク
- 145
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 23
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/PowerAppsCodeApps のほかの issue
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
microsoft/PowerAppsCodeApps#504 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
microsoft/PowerAppsCodeApps#500 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
microsoft/PowerAppsCodeApps#499 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
microsoft/PowerAppsCodeApps#498 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
microsoft/PowerAppsCodeApps#472 ·
メンテナーはふだん 1 日以内に返信
microsoft/PowerAppsCodeApps の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
diegosouzapw/OmniRoute#17386 ·
メンテナーはふだん 1 日以内に返信
-
ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
area/dashboard kind/bug kind/bug-qa QA/dev-automation
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
vybestack/llxprt-code#3917 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
api-parity
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
IBM/carbon-components-ember#1157 ·
メンテナーはふだん 1 日以内に返信