# Merge cloudinary with shopify product images

> Shopify product media plus Cloudinary derived URLs in one feed. For "merge cloudinary with shopify product images", store CLOUDINARY_BASIC_AUTH, SHOPIFY_ACCESS_TOKEN in Secret Vault, call https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/resources/image from a Worker, and let React hit only https://realcomposer.com/v1/workspace/merge-cloudinary-with-shopify-images with an rc_live_ client token.

- Canonical page: https://realcomposer.com/recipes/merge-cloudinary-with-shopify-images
- Client platform: React
- Upstream services: Cloudinary, Shopify
- Category: Multi-API Aggregation
- JSON version: https://realcomposer.com/recipes/merge-cloudinary-with-shopify-images.json
- Install in RealComposer (free plan, pre-fills this pipeline): https://realcomposer.com/dashboard/pipelines/new?recipe=merge-cloudinary-with-shopify-images&via=agent

## Problem: Waterfall latency from multiple Cloudinary and Shopify requests

React widgets often await Cloudinary and Shopify sequentially, multiplying TLS handshakes on cellular networks and amplifying failure rates.

- Race conditions between parallel manual fetches
- Higher mobile data usage from redundant JSON
- Timeouts when any upstream exceeds cellular RTT

## Solution steps

1. **Store upstream credentials in Secret Vault**: Store CLOUDINARY_BASIC_AUTH, SHOPIFY_ACCESS_TOKEN in the vault. React never embeds the raw secret, only a revocable rc_live_ client token.

2. **Configure upstream steps and output mapping**: Use GET against https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/resources/image. Allowed origins on the client token should match leave cache ttl at 0 when each response is user-specific (include userid or record id in query params before enabling cache).

3. **Call from React**: Allowed origins on the token should list every React host that calls this URL.

```
const res = await fetch('https://realcomposer.com/v1/workspace/merge-cloudinary-with-shopify-images', {
  headers: { Authorization: 'Bearer rc_live_your_token' }
});
const data = await res.json();
```

## Pipeline config

Import this config into a RealComposer pipeline. `{{secrets.NAME}}` values are read from the encrypted Secret Vault at request time, so the client never sees them.

```json
{
  "name": "Merge cloudinary with shopify product images",
  "method": "GET",
  "cacheTtlSeconds": 0,
  "authMode": "client_token",
  "steps": [
    {
      "stepKey": "cloudinary",
      "upstreamUrlTemplate": "https://api.cloudinary.com/v1_1/{{secrets.CLOUDINARY_CLOUD_NAME}}/resources/image",
      "httpMethod": "GET",
      "headersTemplate": {
        "Authorization": "Basic {{secrets.CLOUDINARY_BASIC_AUTH}}"
      },
      "timeoutMs": 3000
    },
    {
      "stepKey": "shopify",
      "upstreamUrlTemplate": "https://{{secrets.SHOPIFY_STORE}}.myshopify.com/admin/api/2026-10/products.json?limit=5",
      "httpMethod": "GET",
      "headersTemplate": {
        "X-Shopify-Access-Token": "{{secrets.SHOPIFY_ACCESS_TOKEN}}"
      },
      "timeoutMs": 3000
    }
  ],
  "outputMapping": {
    "version": 1,
    "fields": [
      {
        "targetPath": "cloudinary.publicId",
        "sourcePath": "resources.0.public_id",
        "type": "string",
        "sourceStep": "cloudinary"
      },
      {
        "targetPath": "cloudinary.format",
        "sourcePath": "resources.0.format",
        "type": "string",
        "sourceStep": "cloudinary"
      },
      {
        "targetPath": "shopify.productId",
        "sourcePath": "products.0.id",
        "type": "number",
        "sourceStep": "shopify"
      },
      {
        "targetPath": "shopify.title",
        "sourcePath": "products.0.title",
        "type": "string",
        "sourceStep": "shopify"
      }
    ]
  }
}
```

## Call the pipeline

```bash
curl -X GET "https://realcomposer.com/v1/workspace/merge-cloudinary-with-shopify-images" \
  -H "Authorization: Bearer rc_live_client_token"
```

## Payload before and after

Raw upstream response:

```json
{
  "requestId": "req_merge-cl",
  "upstreamLatencyMs": 142,
  "audit": {
    "region": "edge",
    "trace": "merge-cloudinary-with-shopify-images"
  },
  "payload": {
    "id": "sample_id",
    "status": "active",
    "nested": {
      "tags": [
        "demo"
      ],
      "internal": true
    },
    "unused_blob": {
      "foo": "bar",
      "bar": "baz"
    }
  }
}
```

Slimmed RealComposer response:

```json
{
  "cloudinary_publicId": "sample",
  "cloudinary_format": "sample",
  "shopify_productId": "sample",
  "shopify_title": "sample"
}
```

## FAQ

### Which Cloudinary credential belongs in the vault for this pipeline?

Store CLOUDINARY_BASIC_AUTH, SHOPIFY_ACCESS_TOKEN for merge-cloudinary-with-shopify-images. React never sees decrypted values.

### Does POST traffic get cached?

merge-cloudinary-with-shopify-images POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard.

### What happens if an upstream step times out?

Allowed origins on the merge-cloudinary-with-shopify-images client token restrict which domains may call the edge URL.
