I am currently attempting a simple post request for testing purposes to an API endpoint.
Using lightning V2.10.15 running locally.
For reference:
-
This Post request was working couple weeks ago, but API got updated and i am now getting the following issue.
-
Using post man and the same data being passed in the Openfn job the request is sent successfully.
Here is the OpenFn Job:
fn(state => {
// Define the payload
const payload = {
“poName”: “OFN-Test 04”,
“order_lines”: [
{
“line”: “1”,
“sku”: “AB:B09”,
“qty”: “2”,
“assembled”: “No”,
“length”: “6ft”,
“hinge”: “Right”,
“options”: [
“Option1”,
“Option2”
]
}
],
“shippingAddress”: {
“firstname”: “LOUIS”,
“lastname”: “ST. GEORGE”,
“street1”: “4201 N FEderal Hwy”,
“street2”: “”,
“company”: “”,
“country_id”: “US”,
“region”: “Florida”,
“region_code”: “FL”,
“telephone”: “+1 954-817-3141”,
“fax”: “”,
“postcode”: “33064”,
“city”: “Pompano Beach”
},
“billingAddress”: {
“firstname”: “LOUIS”,
“lastname”: “ST. GEORGE”,
“street1”: “4201 N FEderal Hwy”,
“street2”: “”,
“company”: “”,
“country_id”: “US”,
“region”: “Florida”,
“region_code”: “FL”,
“telephone”: “+1 954-817-3141”,
“fax”: “”,
“postcode”: “33064”,
“city”: “Pompano Beach”
},
“customer_email”: “test@test.com”,
“shipping_method”: “pickupdelivery_pickupdelivery”,
“shippingType”: 1,
“IsLiftgate”: 1,
“IsResidential”: 0,
“ref”: “REF98765”,
“note”: "25% RESTOCKING FEE ",
“cc_email”: “test@test.com”,
“coupon_code”: “DISCOUNT10”,
“warehouseCode”: “FL”,
“pickupDate”: “2025-02-12 18:28:17”
};
// Perform the POST request
return post(pushorder
, {
body: payload,
headers: {
‘Content-Type’: ‘application/json’,
‘Accept’: ‘application/json’
}
})(state);
});
Here is the log from the run with the error:
RTE Memory limit: 500mb
RTE Timeout: 1200s
RTE Payload limit: 10mb
VER Versions:
▸ node.js 18.17.1
▸ worker 1.9.1
▸ @openfn/language-common 2.3.0
▸ @openfn/language-http 7.0.0
R/T Executing 0a4b4f28-dd15-4534-a25d-8ddbb1245ef9
R/T Starting step Test post
R/T [linker] loading module @openfn/language-http
R/T [linker] Loading module @openfn/language-http from /tmp/openfn/worker/repo/node_modules/@openfn/language-http_7.0.0/dist/index.cjs
R/T Resolved adaptor @openfn/language-http to version 7.0.0
R/T Executing expression (1 operations)
R/T Starting operation 1
ADA POST https://jarlin.kitchen365test.com/rest/V1/middleware/pushorder - 400 in 651ms
ADA response body:
ADA {
“errors”: [
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “poName”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “order_lines”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “shippingAddress”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “billingAddress”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “customer_email”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “shipping_method”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “shippingType”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “IsLiftgate”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “IsResidential”
}
}
],
“message”: “One or more input exceptions have occurred.”
}
ADA {
“message”: “POST to https://jarlin.kitchen365test.com/rest/V1/middleware/pushorder returned 400: Bad Request”,
“name”: “Error”
}
R/T Test post aborted with error (1.392s)
R/T Cleaning up state. Removing keys: configuration
R/T Error reported by “fn()” operation line 3:
R/T Error: POST to https://jarlin.kitchen365test.com/rest/V1/middleware/pushorder returned 400: Bad Request
@openfn/language-common/dist/util.cjs:120:19)
@openfn/language-common/dist/util.cjs:206:3)
R/T Additional error details:
R/T {
“body”: {
“errors”: [
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “poName”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “order_lines”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “shippingAddress”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “billingAddress”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “customer_email”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “shipping_method”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “shippingType”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “IsLiftgate”
}
},
{
“message”: “"%fieldName" is required. Enter and try again.”,
“parameters”: {
“fieldName”: “IsResidential”
}
}
],
“message”: “One or more input exceptions have occurred.”
},
“duration”: 651,
“headers”: {
“cache-control”: “no-store”,
“connection”: “keep-alive”,
“content-type”: “application/json; charset=utf-8”,
“date”: “Fri, 21 Mar 2025 12:49:47 GMT”,
“server”: “nginx/1.25.3”,
“transfer-encoding”: “chunked”
},
“message”: “POST to https://jarlin.kitchen365test.com/rest/V1/middleware/pushorder returned 400: Bad Request”,
“method”: “POST”,
“statusCode”: 400,
“statusMessage”: “Bad Request”,
“type”: “Error”,
“url”: “https://jarlin.kitchen365test.com/rest/V1/middleware/pushorder”
}
R/T Check state.errors.18e99cbd-650b-471b-87ca-9ca4528ea78d for details
R/T Run complete with status: fail
AdaptorError: POST to https://jarlin.kitchen365test.com/rest/V1/middleware/pushorder returned 400: Bad Request