Hi, I’ve installed the remix app and created a dev store for creating orders.
For that I’ve created a test route with the following code
import { authenticate } from "../shopify.server";
export const action = async ({ request }) => {
const { shop, topic, payload, admin } = await authenticate.webhook(request);
console.log(`Received ${topic} webhook for ${shop} with payload: ${JSON.stringify(payload, null, 2)}`);
if (admin) {
const response = await admin.graphql(
`#graphql
query {
orders(first: 10) {
edges {
node {
id
updatedAt
}
}
}
}`
);
const orders = await response.json();
console.log(`GraphQL response data: ${JSON.stringify(orders.data, null, 2)}`);
}
return new Response();
};
Now if I go to postman and create a post for that route I get nothing, then I’ve moved the code inside a try catch block
Now I get a response but is 400
I’m not sure what I’m doing wrong