Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

bug: error in payment-onCreatedFunction during payment integration tests #129

Open
jeromevdl opened this issue Jul 9, 2020 · 0 comments
Labels
bug Something isn't working service:orders Issue related to the orders service

Comments

@jeromevdl
Copy link
Contributor

jeromevdl commented Jul 9, 2020

When deploying payment module (make all-payment), there is an error in cloudwatch logs for the payment-onCreatedFunction:

[ERROR] KeyError: 'paymentToken'
Traceback (most recent call last):
  File "/var/task/main.py", line 43, in handler
    payment_token = event["detail"]["paymentToken"]

Looking at the event, we have an OrderCreated event, mixed with a PACKAGING_FAILED status and actually no paymentToken:

{
    "timestamp": "2020-07-09 10:06:19,766",
    "level": "INFO",
    "location": "decorate:195",
    "service": "payment",
    "sampling_rate": 0,
    "cold_start": true,
    "function_name": "ecommerce-dev-payment-OnCreatedFunction-BN6M5X4Z0GYQ",
    "function_memory_size": "128",
    "function_arn": "arn:aws:lambda:eu-central-1:123456789012:function:ecommerce-dev-payment-OnCreatedFunction-BN6M5X4Z0GYQ",
    "function_request_id": "b5dd8fa9-e285-4230-b8ae-eeb4f3b1a270",
    "message": {
        "version": "0",
        "id": "c26030dc-e054-66df-b6f9-8cf149512e74",
        "detail-type": "OrderCreated",
        "source": "ecommerce.orders",
        "account": "123456789012",
        "time": "2020-07-09T10:06:19Z",
        "region": "eu-central-1",
        "resources": [
            "ceccfd49-fc01-4f07-b8f0-73289c0fed34"
        ],
        "detail": {
            "orderId": "ceccfd49-fc01-4f07-b8f0-73289c0fed34",
            "status": "PACKAGING_FAILED"
        }
    }
}

The problem comes from the integration test (test_on_failed_warehouse):

def test_on_failed_warehouse(payment_3p_api_url, eventbridge, event_bus_name, table, order):

Same error and quite similar event for the test_on_failed_delivery:

def test_on_failed_delivery(payment_3p_api_url, eventbridge, event_bus_name, table, order):

{
    "timestamp": "2020-07-09 13:15:13,939",
    "level": "INFO",
    "location": "decorate:195",
    "service": "payment",
    "sampling_rate": 0,
    "cold_start": false,
    "function_name": "ecommerce-dev-payment-OnCreatedFunction-BN6M5X4Z0GYQ",
    "function_memory_size": "128",
    "function_arn": "arn:aws:lambda:eu-central-1:123456789012:function:ecommerce-dev-payment-OnCreatedFunction-BN6M5X4Z0GYQ",
    "function_request_id": "f80301b8-0d87-4234-a38b-eaeec59c2dd1",
    "message": {
        "version": "0",
        "id": "a26a48d1-fc78-e935-50ab-1264c20467ea",
        "detail-type": "OrderCreated",
        "source": "ecommerce.orders",
        "account": "123456789012",
        "time": "2020-07-09T13:14:15Z",
        "region": "eu-central-1",
        "resources": [
            "b37284fe-ce16-4db8-a09c-349d08b539bb"
        ],
        "detail": {
            "orderId": "b37284fe-ce16-4db8-a09c-349d08b539bb",
            "status": "DELIVERY_FAILED"
        }
    }
}
@nmoutschen nmoutschen added bug Something isn't working service:orders Issue related to the orders service labels Jul 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working service:orders Issue related to the orders service
Projects
None yet
Development

No branches or pull requests

2 participants