Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected problem in the flow #17333

Closed
kropsi opened this issue Jan 28, 2023 · 2 comments · Fixed by #17350
Closed

Unexpected problem in the flow #17333

kropsi opened this issue Jan 28, 2023 · 2 comments · Fixed by #17350

Comments

@kropsi
Copy link

kropsi commented Jan 28, 2023

Describe the Bug

I am trying to read information from woocomerce using their API

METHOD: GET
URL: https://my-webshop.com/wp-json/wc/v3/orders/{{$trigger.query.order_number}}
HEADERS: Authorization - Basic .....

I know that the request works as I tested it outside Directus, the response is as described here: https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#retrieve-an-order

I get the following error in the log

[18:56:44.465] WARN: [cache] Couldn't set key 9bc71bad41ee26554321eb56afabd2903b356702. Error: Unexpected argument of type function

    err: {

      "type": "Error",

      "message": "Unexpected argument of type function",

      "stack":

          Error: Unexpected argument of type function

              at getAst (/directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:125:15)

              at /directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:44:51

              at Array.map (<anonymous>)

              at getAst (/directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:44:34)

              at /directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:65:58

              at Array.map (<anonymous>)

              at getAst (/directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:65:22)

              at /directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:65:58

              at Array.map (<anonymous>)

              at getAst (/directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:65:22)

              at compress (/directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:127:17)

              at compress (/directus/node_modules/directus/dist/utils/compress.js:9:62)

              at setCacheValue (/directus/node_modules/directus/dist/cache.js:63:54)

              at /directus/node_modules/directus/dist/middleware/respond.js:35:45

              at /directus/node_modules/directus/dist/utils/async-handler.js:3:66

              at Layer.handle [as handle_request] (/directus/node_modules/express/lib/router/layer.js:95:5)

    }

while as output of the webhook I get a code Z_BUF_ERROR

I am not sure what it is. Seems like an error with caching, but I am not sure what to do with this.

To Reproduce

  1. Setup Webhook / Request URL with a call to woocomerce api - Retrieve an order
  2. Run

Errors Shown

the error in the server log

[18:56:44.465] WARN: [cache] Couldn't set key 9bc71bad41ee26554321eb56afabd2903b356702. Error: Unexpected argument of type function

    err: {

      "type": "Error",

      "message": "Unexpected argument of type function",

      "stack":

          Error: Unexpected argument of type function

              at getAst (/directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:125:15)

              at /directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:44:51

              at Array.map (<anonymous>)

              at getAst (/directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:44:34)

              at /directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:65:58

              at Array.map (<anonymous>)

              at getAst (/directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:65:22)

              at /directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:65:58

              at Array.map (<anonymous>)

              at getAst (/directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:65:22)

              at compress (/directus/node_modules/@directus/shared/dist/cjs/utils/compress.js:127:17)

              at compress (/directus/node_modules/directus/dist/utils/compress.js:9:62)

              at setCacheValue (/directus/node_modules/directus/dist/cache.js:63:54)

              at /directus/node_modules/directus/dist/middleware/respond.js:35:45

              at /directus/node_modules/directus/dist/utils/async-handler.js:3:66

              at Layer.handle [as handle_request] (/directus/node_modules/express/lib/router/layer.js:95:5)

    }

The output of webhook

{
  "message": "unexpected end of file",
  "name": "Error",
  "stack": "Error: unexpected end of file\n    at AxiosError.from (file:///directus/node_modules/axios/lib/core/AxiosError.js:89:14)\n    at BrotliDecompress.handleStreamError (file:///directus/node_modules/axios/lib/adapters/http.js:489:29)\n    at BrotliDecompress.emit (node:events:525:35)\n    at emitErrorNT (node:internal/streams/destroy:151:8)\n    at emitErrorCloseNT (node:internal/streams/destroy:116:3)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)",
  "config": {
    "transitional": {
      "silentJSONParsing": true,
      "forcedJSONParsing": true,
      "clarifyTimeoutError": false
    },
    "adapter": [
      "xhr",
      "http"
    ],
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "timeout": 0,
    "xsrfCookieName": "XSRF-TOKEN",
    "xsrfHeaderName": "X-XSRF-TOKEN",
    "maxContentLength": -1,
    "maxBodyLength": -1,
    "env": {},
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "Authorization": "Basic .....",
      "Content-Type": "application/json",
      "User-Agent": "axios/1.2.1",
      "Content-Length": "4",
      "Accept-Encoding": "gzip, compress, deflate, br"
    },
    "url": "https://my-webshop.com/wp-json/wc/v3/orders/4276",
    "data": "null",
    "method": "get"
  },
  "code": "Z_BUF_ERROR",
  "status": null
}

What version of Directus are you using?

9.22.3

What version of Node.js are you using?

18.13.0

What database are you using?

13

What browser are you using?

Firefox

How are you deploying Directus?

Docker

@github-actions
Copy link

Linear: ENG-599

@rijkvanzanten
Copy link
Member

Looks like a known bug in Axios: axios/axios#5346

@rijkvanzanten rijkvanzanten mentioned this issue Jan 30, 2023
9 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants