[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
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- databases, react, typescript, vite
- Domínio
- backend-api-design, databases, mobile
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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).
- Linguagem predominante
- TypeScript
- Estrelas
- 516
- Forks
- 145
- Merge médio
- 1d 10h
- PRs com merge (30d)
- 23
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de microsoft/PowerAppsCodeApps
-
bug
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
microsoft/PowerAppsCodeApps#508 ·
Mantenedores costumam responder em até 1 dia
-
[Bug] Local Play always fails with "Code app URL is not available" when EnableAuthenticatedGateway feature gate is onTalvez já em andamento @jiankai82 assumiu há 1 dia. Abertabug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
microsoft/PowerAppsCodeApps#504 · 1 comentário · 1 reação · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
microsoft/PowerAppsCodeApps#499 ·
Mantenedores costumam responder em até 1 dia
-
pa CLI cannot reach default-prefixed environments (DNS ENOTFOUND); Dataverse connector rejects current as organization in default envTalvez já em andamento @EvanCahill assumiu há 1 dia. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 22/100
microsoft/PowerAppsCodeApps#472 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
[Bug] shared_odbc with on-prem fails pointing to placeholder URLTalvez já em andamento @tonystevenj assumiu há 9 dias. Abertabug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
microsoft/PowerAppsCodeApps#465 · 1 comentário · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de microsoft/PowerAppsCodeApps
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
paperclipai/paperclip#17151 ·
Mantenedores costumam responder em até 1 dia
-
needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
AgoraIO-Extensions/agent-infra#3159 ·
Mantenedores costumam responder em até 1 dia
-
blocklist addition
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 66/100
MetaMask/eth-phishing-detect#304596 ·
Mantenedores costumam responder em até 1 dia
-
friction
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
kentcdodds/kody#4142 ·
-
[Bug] Statistics | Task statistics are always empty on MikroORM with MySQL or SQLiteTalvez já em andamento @NdekoCode assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
ever-co/ever-gauzy#11214 ·
Mantenedores costumam responder em até 1 dia