Help

Re: New error in automation script : Error: Request processing is disabled due to earlier failed req

189 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Pierre-Alexand2
6 - Interface Innovator
6 - Interface Innovator

Hi, I keep getting this new message in the automation script ide :

Error: Request processing is disabled due to earlier failed request

It seem like airtable does not want to rerty a fetch that previously failed even if the input parameters have changed. Anybody else is getting this?

It's the first day that I saw this message and it's a bit combersome.

4 Replies 4

Hello @Pierre-Alexand2,
I don't think this is a new error. 

As per my understanding, It just said that you're API or any other request you made to get external data fusing fetch failed, and due to that the further process is disabled to response failed. 
Maybe I'm wrong but to understand your error in more depth you need to share your code with excluding credentials.
Also, explain what API you're trying to use with data parameters.

I hope it helps. Please do 👍 if you like it.

I also just got this error as a one-off.

I didn't have any failed prior requests...

Hello @abr & @Pierre-Alexand2
Can you guys able to share your JS code scripts? 
Please also make sure you exclude credentials.
👍

Pierre-Alexand2
6 - Interface Innovator
6 - Interface Innovator

Hi, here is the script in question:

 

async function getToken() {
  let response = await fetch('https://api.novoxpress.ca/prod/auth/get-token', {
    method: 'POST',
    headers: {
      accept: '*/*',
      username: 'XXXX',
      password: 'XXXX'
    }
  })
  let data = await response.json()
  console.log('Token data: ', data)
  return data.response.token
}


async function createShipment(token, serviceId, requestId, param) {
  let response = await fetch('https://api.novoxpress.ca/prod/shipment/create-shipment', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      "service_id": serviceId,
      "request_id": requestId,
      "details": {
        "sender": param.sender,
        "recipient": param.recipient,
        "payment_type": "Sender",
        "packaging_type": "package",
        "packaging_properties": param.packaging_properties,
        "additional_options": {
          "declared_value": param.declared_value,
          "signature_option": "SR"
        },
        "reason_for_export": "Permanent",
        "business_relationship": "NotRelated",
        "non_delivery": "RTS",
        "internationalForms": param.internationalForms
      }
    })
  })
  let data = await response.json()
  console.log('Shipment details: ', data)
  let shipmentId = data.shipment_id
  let trackingNumber = data.tracking_number 
  return { shipmentId, trackingNumber }
}


async function getLabel(shippingId, token) {
  console.log(shippingId)
  console.log(token)
  let response = await fetch('https://api.novoxpress.ca/prod/shipment/print-label', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    body: new URLSearchParams({
        "shipment_id": shippingId,
        "label_type": "EightFiveByEleven"
      }).toString()
  })
  if (response.ok) {
    let data = await response.json()
    console.log('Label details: ', data)
    return [{ url: data?.label?.shipping_label || '' }, { url: data?.label?.CustomsInvoiceThermal || '' }]
  }else{
    throw new Error('Error fecthing label')
  }
}


async function updateShipmentReord(labelUrl, shippingRecordId, trackingNumber, carrier, shipmentId) {
  const shippingTable = base.getTable('tblFhBOpSFpTjv47Z')
  const shippingDocumentsFieldId = 'fldfe8ZJCZ9nq5fbN'
  const carrierFieldId = 'fldFHvJJ6N1SghQLl'
  const trackingNumberFieldId = 'fld2fpolAqrkkzFmv'
  const shippingIdField = 'fldjR8loIDplIDG4C'

  await shippingTable.updateRecordAsync(shippingRecordId[0], {
    [carrierFieldId]: carrier,
    [trackingNumberFieldId]: trackingNumber,
    [shippingDocumentsFieldId]: labelUrl,
    [shippingIdField]: shipmentId
  })
}


async function main() {
  const { parameters, shippingRecordId, serviceId, requestId, carrier } = input.config()
  let param = JSON.parse(parameters)
  console.log('Param: ', param)
  let token = await getToken()
  let { shipmentId, trackingNumber } = await createShipment(token, serviceId, requestId, param)
  let labelUrl = getLabel(shipmentId, token)
  updateShipmentReord(labelUrl, shippingRecordId, trackingNumber, carrier, shipmentId)
}


await main()

 

 

In this script, the airtable automation script IDE will always throw this error 

 

Error: Request processing is disabled due to earlier failed request
    at getLabel on line 54    at main on line 97    at async main on line 102

When using postman with the same token and shippingId, the endpoint work fine.