I have a Remix app with a custom endpoint that I want Flow to send a POST request to, but I’m unable to authenticate the request from Flow’s “Send HTTP request” action which I created and enabled using the Flow admin gui.
My endpoint is public and I haven’t added any headers to the Flow action. The Flow action body is plain text and right now just says “hello world” since I’m stuck on authentication. I did try adding the Content-Type: application/json
header and made the body into JSON, but the result is the same.
I debugged by logging the request headers and I don’t see an HMAC header. I’m running the Shopify CLI app dev and the Flow action URL is set to my Cloudflare tunnel address (which I update when needed) + endpoint route. I know my endpoint hits successfully because the console.log()
before authentication works fine, but I just can’t work out the authentication bit.
What am I doing wrong?
The error I see in my dev console is:
[shopify-app/INFO] Authenticating flow request
[shopify-app/ERROR] Received an invalid flow request | {reason: missing_hmac}
Here’s what I’m trying:
import { authenticate } from "../shopify.server";
export const action = async ({ request }) => {
console.log('Test!'); // <------ this outputs in my dev console
const {admin, payload} = await authenticate.flow(request);
// nothing after this line logs to console and I see the missing_hmac error above
const query = await admin.graphql(
`#graphql
query {
customer(id: "gid://shopify/Customer/7501057097902") {
locations: metafield(namespace: "custom", key: "customer_locations") {
value
}
}
}`);
const { data } = await query.json();
console.log(data);
// will do more stuff here
return new Response();
};