Skip to content

durable-objects example returns 500 for list IDs that contain "add" #108

Closed

Description

@RaphaelFakhri

The durable-objects example routes requests with substring checks in src/entry.py:

if "/add" in url.path:
    message = url.path.split("/")[3]
    ...
elif "/show" in url.path:

Any list ID that starts with add matches the first branch, so a show request is handled as an add request and fails with IndexError.

Steps to reproduce

  1. cd durable-objects
  2. uv run pywrangler dev
  3. curl -i http://localhost:8787/address-book/show

Expected result

HTTP 200 with No messages.

Actual result

HTTP 500. The Worker raises IndexError: list index out of range at url.path.split("/")[3]. GET /room-1/add without a message fails the same way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions