Greenstand / Greenstand/treetracker-wallet-api
Wallet image upload fails on dev with invalid AWS access key, and the failed upload rolls back the whole profile update
- Dominant language
- JavaScript
- Stars
- 19
- Forks
- 69
- Avg merge
- 7m
- Merged PRs (30d)
- 1
Description
**Target branch: `keycloak`** (deployed at dev-k8s `/wallet/keycloak`, used by https://wallet-dev.treetracker.org).
## Repro (2026-08-14, wallet-dev)
Open `/wallet/customize?name=`, choose a logo or hero image, save. The PATCH fails and the app shows:
> Unknown error (The AWS Access Key Id you provided does not exist in our records.)
## Two problems
1. **Infra:** the S3 client on the dev wallet-api deployment is configured with an AWS access key that does not exist (invalid, rotated, or missing credentials in the deployment env), so every `upload()` (`server/services/S3Service.js`, `server/infra/aws/s3.js`) is rejected by AWS. Image customization is completely broken on dev.
2. **API behavior:** in `WalletService.updateWallet` the S3 upload runs inside the DB transaction, before the row update. When the upload throws, the transaction rolls back and all changes in that save are lost, including `display_name`/`about` text edits submitted alongside the image. The raw AWS SDK message also leaks to the client, giving users no actionable information.
## Suggested fix
- Infra: fix or rotate the S3 credentials (and bucket config) for the dev deployment; consider a startup or health check that validates S3 access.
- API: map S3 failures to a clear error (e.g. 502/503 "image upload unavailable") instead of passing the AWS SDK message through; optionally apply text-field updates independently of image upload success.
## Acceptance criteria
- Uploading a wallet logo/hero on wallet-dev succeeds and the image URL is persisted.
- If S3 is down, the client receives a clear error and text-only edits in the same request are not silently lost (or the behavior is documented).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with WalletService.updateWallet and trace the upload through server/services/S3Service.js and server/infra/aws/s3.js, then inspect the dev-k8s wallet-api deployment credentials and bucket configuration. Reproduce the failure on wallet-dev and verify that successful image uploads persist their URL, while S3 failures return a clear client error without silently losing accompanying text edits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, javascript
- Domain
- api, backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100