Skip to content

load_test_data.py throws errors on startup and returns 401 on all webhook calls #21

@Ananya-CM

Description

@Ananya-CM

While setting up the project locally and running the test data loader,
ran into a few issues that prevent any data from being ingested.

Problems found:

  1. The ts field in SAMPLE_SLACK_MESSAGES is a float number but the Go
    ingestion service expects it as a string. This causes a JSON unmarshal
    error and every Slack webhook call returns 400.

  2. Related to the above — int(message['ts']) in create_slack_event()
    crashes with a ValueError because you can't directly cast a float string
    like "1711097400.000001" to int. Needs int(float(...)) instead.

  3. The script sends raw POST requests with no signature headers. The
    ingestion service validates HMAC signatures for both Slack and GitHub
    webhooks, so every request returns 401 without them.

Fix:

  • Changed all ts values to strings in SAMPLE_SLACK_MESSAGES
  • Fixed int(message['ts']) → int(float(message['ts']))
  • Added X-Slack-Signature + X-Slack-Request-Timestamp headers for Slack
  • Added X-Hub-Signature-256 + X-GitHub-Event headers for GitHub

After these fixes all 8 events load successfully.

Steps to reproduce:
Clone the repo, run docker-compose up -d, then python test_data/load_test_data.py
and observe the 401 and 400 errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions