Expand my Community achievements bar.

SOLVED

Calling webaction from Postman returns 204 instead of printing response message

Avatar

Level 7

I wrote a simple webaction and deployed to my workspace

 

import { setGlobals } from "./common.mjs";

function main(params) {
  setGlobals(params);
  return { result: "Trigger runtime action successfully" };
}

const _main = main;
export { _main as main };

 

When I call the action from Postman, I only receive a 204 and NO response message 

sarav_prakash_0-1727114373912.png

But I know web-action is invoked, coz when I add log statements, they are logged successfully. What am I missing? Why is the result message not returned when invoked from Postman?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 7

The return object was missing statusCode. Changing the response like this fixed this

import { setGlobals } from "./common.mjs";

function main(params) {
  setGlobals(params);
  return {
    headers: { "Content-Type": "application/json" },
    statusCode: 200,
    body: { result: "Item ingest action triggered successfully" },
  };
}

const _main = main;
export { _main as main };

 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 7

The return object was missing statusCode. Changing the response like this fixed this

import { setGlobals } from "./common.mjs";

function main(params) {
  setGlobals(params);
  return {
    headers: { "Content-Type": "application/json" },
    statusCode: 200,
    body: { result: "Item ingest action triggered successfully" },
  };
}

const _main = main;
export { _main as main };