Can't create custom sidebar widgets from Devvit apps due to empty imageData array
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- api, backend-api-design
Research direction
Reproduce the moderator-scope addWidget calls from the issue, comparing textarea, custom with empty imageData, and custom with an uploaded image. Then inspect devvit/plugin/redditapi/widgets/widgets_msg.proto, especially WidgetImage, and the addWidget/updateWidget serialization paths. Done means no-image custom widgets can be created, or image metadata is mapped correctly, with the supported Devvit Web path documented.
Written by the indexing model from the issue text.
Description
Summary
Devvit apps with moderator scope can create textarea sidebar widgets, but reddit.addWidget({ type: 'custom' }) fails when we try to create a styled custom widget (HTML + CSS + height, no images).
reddit.updateWidget({ type: 'custom' }) can update text/css/height on an existing custom widget — but automated install/bootstrap cannot create the widget in the first place.
Environment
- Devvit Web app with moderator Reddit permissions
@devvit/web/devvit: 0.13.7devvit.json:permissions.reddit.enable: true,scope: "moderator"- Reproduced on a private playtest subreddit
What works (for comparison)
await reddit.addWidget({
type: 'textarea',
subreddit: context.subredditName!,
shortName: 'My App Widget',
text: '### Section title\n\nPlaceholder content',
styles: { backgroundColor: '#0d0f11', headerColor: '#ffb900' },
});
// ✅ succeeds
What fails — example 1: CSS-only custom widget (no images)
This is what we need for a styled sidebar with scoped CSS and no widget images:
await reddit.addWidget({
type: 'custom',
subreddit: context.subredditName!,
shortName: 'My App Widget',
text: '# My App Widget\n\n*Placeholder*',
css: '/**/',
height: 200,
imageData: [],
styles: { backgroundColor: '#0d0f11', headerColor: '#ffb900' },
});
Observed errors (varies by attempt):
- Reddit rejects the payload when
imageDatais omitted or empty - e.g. errors about
imageDatabeing missing or having an unexpected JSON structure when passing[]
What fails — example 2: custom widget with lease-uploaded placeholder image
We also tried satisfying Reddit's imageData requirement with a 1×1 PNG via the widget image upload lease (S3 URL on an allowed domain):
await reddit.addWidget({
type: 'custom',
subreddit: context.subredditName!,
shortName: 'My App Widget',
text: '# My App Widget',
css: '/**/',
height: 200,
imageData: [
{
url: 'https://reddit-subreddit-uploaded-media.s3-accelerate.amazonaws.com/...',
linkUrl: '',
width: 1,
height: 1,
},
],
styles: { backgroundColor: '#0d0f11', headerColor: '#ffb900' },
});
Observed error:
JSON missing key: "name"
Reddit's API expects each imageData entry to include a name field. Devvit's WidgetImage proto only exposes url, linkUrl, width, height — no name — so the platform appears to strip or omit it before the request reaches Reddit.
Proto reference: devvit/plugin/redditapi/widgets/widgets_msg.proto → message WidgetImage
What partially works
If a custom widget already exists on the subreddit (created outside the app), Devvit can update it:
await reddit.updateWidget({
type: 'custom',
subreddit: context.subredditName!,
id: existingWidgetId,
shortName: 'My App Widget',
text: '<p class="widget-title">...</p>',
css: '/* scoped widget styles */',
height: 280,
imageData: [],
styles: { backgroundColor: '#0d0f11', headerColor: '#ffb900' },
});
// ✅ appears to work when widget already exists (empty imageData omitted in UpdateCustomWidgetRequest.toJSON)
This is not viable for onAppInstall across all installing subreddits.
Expected
reddit.addWidget({ type: 'custom' })should support no-image custom widgets (imageData: [])- If images are required,
WidgetImageshould includename(or map it correctly server-side) - Document the supported custom widget create path for Devvit Web
Impact
Apps that need styled sidebar content (HTML + CSS) cannot self-bootstrap on install. They fall back to plain textarea widgets or require manual setup outside Devvit.
Thanks!
- Dominant language
- TypeScript
- Stars
- 210
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from reddit/devvit
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 5/5 Over a week Newbie friendliness 42/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
area:tools bug good first issue help wanted priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
TaewoooPark/Motifcode#14 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
newrelic-experimental/preflight#793 · 1 comment ·
-
bug 🐞
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BasedHardware/omi#15320 ·