FROM CACHE - en_header

I am getting error 422 while trying to create order

tabontech123
Tourist
3 0 1

I am getting this error while creating orders programmatically. 

My code:

 

  router.post("/createOrders"verifyRequest(), async (ctxres=> {
    const { shopaccessToken } = ctx.session;
    const url = `https://${shop}/admin/api/2021-07/orders.json`;
    // const session = await Shopify.Utils.loadCurrentSession(ctx.req, ctx.res);

    ctx.body = ctx.request.body;

    // console.log(ctx.request.body[0].line_items);

    const shopifyHeader = (Token=> ({
      "Content-Type": "application/json",
      "X-Shopify-Access-Token": Token,
    });

    const data = {
      order: {
        email: "adam123445@example.com",
        fulfillment_status: "fulfilled",
        fulfillments: [{ location_id: 487523303 }],
        line_items: [{ variant_id: 447656429quantity: 1 }],
      },
    };

    const myorder = await axios
      .post(urldata, {
        headers: shopifyHeader(accessToken),
      })
      .then((res=> console.log(res));

 
    console.log("result: "res);
  });

 

 

Error: Request failed with status code 422
at createError (D:\ShopifyApps\SkuShopify\node_modules\axios\lib\core\createError.js:16:15)
at settle (D:\ShopifyApps\SkuShopify\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (D:\ShopifyApps\SkuShopify\node_modules\axios\lib\adapters\http.js:269:11)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1317:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)

Reply 1 (1)
odap-985
Tourist
3 0 0

hey mate, I am having the same problem did you find a solution?