Hi @raquelrojo,
Hi Raquel,
Based on your description, the workflow is running without errors, but Shopify isn’t creating the customer. This is a common frustration—let’s walk through the likely causes and how to debug them, especially in the context of Pipedream and Shopify’s Admin API.
1. Check Shopify API Response Carefully
Even if axios
doesn’t throw, Shopify may return a 200/201 with an error in the response body (e.g., validation errors). Shopify often returns errors in the response JSON under an errors
key, even with a 200 status.
Action:
Log and inspect the entire response body, not just response.data
. Look for an errors
property.
import { axios } from "@pipedream/platform";
export default defineComponent({
props: {
shopify: {
type: "app",
app: "shopify",
},
customer: {
type: "object",
label: "Customer Data",
description: "Customer object to send to Shopify",
},
},
async run({ steps, $ }) {
const url = `https://${this.shopify.$auth.shop_id}.myshopify.com/admin/api/2024-04/customers.json`;
const payload = { customer: this.customer };
const response = await axios($, {
method: "post",
url,
headers: {
"X-Shopify-Access-Token": this.shopify.$auth.oauth_access_token,
"Content-Type": "application/json",
},
data: payload,
returnFullResponse: true, // Get status, headers, etc.
});
// Log everything for debugging
$.export("shopify_response", response);
// Check for errors in the response body
if (response.data && response.data.errors) {
throw new Error(`Shopify API error: ${JSON.stringify(response.data.errors)}`);
}
return response.data;
},
});
2. Payload Format
Shopify is strict about payload shape. For /customers.json
, the payload must be:
{
"customer": {
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"tags": "tag1, tag2"
}
}
- Tags should be a comma-separated string, not an array.
- Remove any undefined/null fields from the payload.
3. API Permissions & Endpoint
- Make sure you’re using the correct API token (private app or custom app) and that it’s for the right store.
- Double-check the endpoint:
https://yourcolourcompass.myshopify.com/admin/api/2024-04/customers.json
- Use the token in the
X-Shopify-Access-Token
header (not as a Bearer token).
4. Other Shopify Requirements
- Email: Must be unique and valid.
- Password: Not required for customer creation via API.
- Account Activation: By default, customers are created as “disabled” unless you set
"send_email_invite": true
(optional).
5. Debugging Tips
- Try sending the same payload via Shopify API Console or Postman to see if you get a more descriptive error.
- Add more logging in Pipedream: log the request payload, response status, and full response body.
6. Hiring Help
If you’d like direct assistance, you can contact Pipedream support or post on their community for more hands-on debugging.
Summary Checklist
- Log and inspect the full Shopify API response for errors.
- Double-check payload shape and content.
- Confirm token permissions and correct endpoint.
- Try the request outside Pipedream for comparison.
- ] Contact [Pipedream support if you need more help or want to hire someone.
If you share your exact code and a sample payload (with sensitive info redacted), I can help review it line by line!
Let me know how it goes or if you want to dig deeper.
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double-check my answers and code! Learn how to build your own.