API error (possibly related to gzip?)

Having trouble with an API that works in Postman.

Error received on the localhost node server:


  server-connect:app Executing action step send +2ms
  server-connect:app options: {
  server-connect:app   url: 'https://api-demo.mlsgrid.com/v2/Property',
  server-connect:app   params: {
  server-connect:app     '$filter': "OriginatingSystemName eq 'mfrmls' and MlgCanView eq true",
  server-connect:app     '$expand': 'Media',
  server-connect:app     '$top': '5'
  server-connect:app   },
  server-connect:app   schema: [],
  server-connect:app   headers: {
  server-connect:app     Authorization: 'Bearer 40f7218df9REDACTEDaf1c7f15d89',
  server-connect:app     'Accept-Encoding': 'gzip, deflate, br',
  server-connect:app     Accept: '*/*',
  server-connect:app     'Cache-Control': 'no-cache'
  server-connect:app   },
  server-connect:app   passErrors: false
  server-connect:app } +0ms
SyntaxError: Unexpected token  in JSON at position 0
    at JSON.parse (<anonymous>)
    at IncomingMessage.<anonymous> (/Users/pauka/WapplerProjects/tbd/lib/modules/api.js:84:41)
    at IncomingMessage.emit (node:events:390:22)
    at endReadableNT (node:internal/streams/readable:1307:12)
    at processTicksAndRejections (node:internal/process/task_queues:81:21)

If I remove the Accept-Encoding, the remote api errors stating it is required.

Interestingly, the Define API Schema does work. It is just when I actually run the action that things break down.

Please test this update, unzip in lib/modules.

api.zip (1.3 KB)

1 Like

Thanks. That takes care of it.

This has been fixed in Wappler 4.1.0

This topic was automatically closed after 25 hours. New replies are no longer allowed.