Hi
Solution :
Even I faces this While working on web trigger .
Only we have to send response in specific format
Example:
manifest.yml
webtrigger:
- key: testing-api
function: TESTING-api
response: dynamic data by default.
type: dynamic
function:
- key: TESTING-api
handler: testing.run #
Example Handler Function
testing.js
import api, { route } from "@forge/api"; // Resonse give correctly export async function run(req) { try { console.log(" Webtrigger invoked: addAttachment (TEST MODE)"); // Step 1: Parse request console.log(" Raw request body:", req.body); // Step 2: Use dummy payload const body = { issueKey: "TEST-123", fileName: "dummy.txt", fileContentBase64: "ZHVtbXk=", // "dummy" in base64 }; console.log(" Dummy payload prepared:", body); // Step 3: Prepare dummy Jira API response const data = { success: true, status: 200, attachment: { id: "10001", filename: body.fileName, size: 123, mimeType: "text/plain", }, }; console.log(" Fake Jira response generated:", data); // Step 4: Returning response console.log(" Returning success response with status 200"); return { statusCode: 200, contentType: "application/json", body: JSON.stringify(data), }; } catch (err) { console.error(" Error in addAttachment (TEST MODE):", err); const errorData = { success: false, error: err.message, }; console.log(" Returning error response with status 500"); return { statusCode: 500, contentType: "application/json", body: JSON.stringify(errorData), }; } }
Also @BrettB here is detail solution for your request also:Webtrigger returning 424 Failed dependency
Do check and if Faced any issue let me know .Because its working for me
Thanks!!!
