Skip to content

bug(content): aem content push silently drops JSON file changes #2743

@shsteimer

Description

@shsteimer

Summary

Running aem content push after editing a JSON file logs and advances the synced ref, but the file in DA is unchanged.

Root Cause

putSource in src/content/da-api.js sends all files via PUT with a raw request body and Content-Type set to the file's MIME type (e.g. application/json for .json files).

The DA admin API (admin.da.live) only accepts raw body uploads for text/html. For application/json (and every other content type), putHelper in da-admin returns undefined. putObject then writes an empty {} to the file's props sidecar and skips the content file entirely. It still returns 201 with a valid JSON body, so helix-cli treats the push as successful and advances the synced ref. The file change is silently dropped.

This appears to be intentional da-admin behavior. The test suite asserts it:

it('Returns undefined for application/json raw body', async () => {
  // ...
  assert.strictEqual(helped, undefined);
});

What the DA API Expects

The DA API docs (https://docs.da.live/developers/api/source) require multipart/form-data POST for all file types:

# JSON file
curl -X POST \
  'https://admin.da.live/source/org/site/data.json' \
  --header 'Authorization: Bearer {IMS_TOKEN}' \
  --form 'data=@/path/to/data.json'

The server accepts both PUT and POST (same handler), so the HTTP method is not the issue. The body format is.

Impact

Any non-HTML file pushed via aem content push silently fails to update in DA.

Fix

Update putSource to use POST + multipart/form-data for all file types, wrapping the buffer in a Blob in the data field. The text/html raw body path is an undocumented server-side shortcut and should not be the basis for how helix-cli uploads files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions