These docs are for v1.0. Click to read the latest docs for v2024.09.

Discussions

Ask a Question
Back to All

Unable to genrate label with vague error message "undefined method `[]' for nil:NilClass"

Hello, we are unable to generate label and we are receiving "undefined method `[]' for nil:NilClass" error. We also noticed that the country in the response for the origin address is United States although it is sent in the request as GB (United Kingdom). Can someone please help us generate a label?
The request:

{
    "origin_address": {
        "name": "Customer",
        "company_name": "Customer",
        "line_1": "84 hartley green gardens",
        "line_2": "",
        "state": "billinge",
        "city": "wigan",
        "postal_code": "wn57ga",
        "country_alpha2": "GB",
        "phone_number": "+3106-89826441",
        "email_address": "[email protected]"
    },
    "output_currency": "USD",
    "platform_name": "Open Border - #L11962-gb-3",
    "platform_order_number": "#L11962-gb-3",
    "taxes_duties_paid_by": "receiver",
    "is_insured": false,
    "destination_country_alpha2": "GB",
    "destination_city": "wigan",
    "destination_state": "billinge",
    "destination_postal_code": "wn57ga",
    "destination_address_line_1": "85 hartley green gardens",
    "destination_address_line_2": "",
    "destination_name": "Luminskin TEST",
    "destination_company_name": "Luminskin TEST",
    "destination_phone_number": "+3106-89826441",
    "destination_email_address": "[email protected]",
    "items": [
        {
            "actual_weight": 0.0453592,
            "height": 0,
            "width": 0,
            "length": 0,
            "category": "Accessory",
            "declared_currency": "USD",
            "declared_customs_value": 0.01,
            "quantity": 1,
            "sku": "S1A",
            "description": "S1A",
            "origin_country_alpha2": "KR",
            "hs_code": "330499"
        }
    ],
    "box": {
        "length": 1,
        "width": 1,
        "height": 1
    },
    "buy_label_synchronous": true,
    "format": "url",
    "label": "4x6",
    "consignee_tax_id": "",
    "allow_courier_fallback": false
}

This is the response:

{
    "shipment": {
        "created_at": "2023-02-10T04:30:28.874Z",
        "updated_at": "2023-02-10T04:30:29.852Z",
        "order_created_at": null,
        "easyship_shipment_id": "ESUS130419122",
        "origin_address": {
            "id": "f5511da8-9e27-475b-be7f-59d4c3cec809",
            "company_name": "Customer",
            "contact_name": "Customer",
            "contact_email": "[email protected]",
            "contact_phone": "+3106-89826441",
            "line_1": "84 hartley green gardens",
            "line_2": "",
            "postal_code": "wn57ga",
            "city": "wigan",
            "state": "billinge",
            "country": {
                "name": "United States"
            },
            "default_values": {
                "pickup": false,
                "billing": false,
                "sender": false,
                "return": false
            }
        },
        "store_name": "Open Border",
        "set_as_residential": false,
        "destination_name": "Luminskin TEST",
        "destination_company_name": "Luminskin TEST",
        "consignee_tax_id": "",
        "destination_address_line_1": "85 hartley green gardens",
        "destination_address_line_2": null,
        "destination_city": "wigan",
        "destination_state": "billinge",
        "destination_postal_code": "WN5 7GA",
        "destination_phone_number": "+310689826441",
        "destination_email_address": "[email protected]",
        "order_notes": null,
        "buyer_notes": null,
        "seller_notes": null,
        "order_tag_list": [],
        "platform_order_number": "#L11962-gb-3",
        "platform_name": "Open Border - #L11962-gb-3",
        "total_customs_value": 0.01,
        "total_actual_weight": 0.045,
        "total_dimensional_weight": 0.0,
        "total_volumetric_weight": 0.045,
        "is_insured": false,
        "currency": "USD",
        "shipment_state": "created",
        "pickup_state": "not_requested",
        "delivery_state": "not_created",
        "label_state": "technical_failed",
        "warehouse_state": "none",
        "label_url": null,
        "tracking_number": "ESUS130419122",
        "tracking_page_url": "https://www.trackmyshipment.co/shipment-tracking/ESUS130419122",
        "label_generated_at": null,
        "label_response": {
            "errors": [
                "undefined method `[]' for nil:NilClass"
            ],
            "status": "failure",
            "cost": 12.99,
            "available_balance": 37.01
        },
        "origin_country": {
            "name": "United States",
            "alpha2": "US"
        },
        "destination_country": {
            "name": "United Kingdom",
            "alpha2": "GB"
        },
        "items": [
            {
                "id": "ee1ebd88-b0f4-4540-b83c-2432d018c3d4",
                "description": "S1A",
                "sku": "S1A",
                "width": 0.0,
                "length": 0.0,
                "height": 0.0,
                "actual_weight": 0.045,
                "dimensional_weight": 0.0,
                "volumetric_weight": 0.045,
                "declared_customs_value": 0.01,
                "declared_currency": "USD",
                "origin_customs_value": 0.01,
                "origin_currency": "USD",
                "category": null,
                "quantity": 1
            }
        ],
        "box": {
            "name": null,
            "length": "1.0",
            "width": "1.0",
            "height": "1.0"
        },
        "selected_courier": {
            "id": "1422eb90-f90a-4afa-a7b2-83657ee54582",
            "name": "FedEx Cross Border Untracked",
            "min_delivery_time": "10",
            "max_delivery_time": "20",
            "shipment_charge": 12.99,
            "fuel_surcharge": 0.0,
            "remote_area_surcharge": 0.0,
            "remote_area_surcharges": {},
            "other_surcharges": {},
            "oversized_surcharge": 0.0,
            "additional_services_surcharge": 0.0,
            "residential_full_fee": 0.0,
            "residential_discounted_fee": 0.0,
            "shipment_charge_total": 12.99,
            "warehouse_handling_fee": 0.0,
            "insurance_fee": 0.0,
            "import_tax_charge": 0.0,
            "import_tax_non_chargeable": 0.0,
            "import_duty_charge": 0.0,
            "ddp_handling_fee": 0.0,
            "total_charge": 12.99,
            "is_above_threshold": true,
            "effective_incoterms": "DDU",
            "estimated_import_tax": 2.6,
            "estimated_import_duty": 0.0,
            "courier_does_pickup": null,
            "courier_dropoff_url": "https://tools.usps.com/find-location.htm?",
            "available_handover_options": "dropoff,free_pickup",
            "courier_remarks": null,
            "payment_recipient": "Easyship"
        },
        "is_merged": false,
        "discount": {
            "code": null,
            "amount": 0,
            "expires_at": null,
            "percentage": null,
            "origin_amount": 0
        }
    }
}