effect icon indicating copy to clipboard operation
effect copied to clipboard

HttpApiEndpoint: `setPath` silently decides to cap path parameters to 100 characters

Open ariady-putra opened this issue 6 months ago • 0 comments

What version of Effect is running?

No response

What steps can reproduce the bug?

  .add(
    HttpApiEndpoint
      .get("addressTransactions", "/api/v0/addresses/:address")
      .setPath(
        Schema.Struct({ address: Schema.String })
      )
      .setUrlParams(
        Schema.Struct({ count: Schema.NumberFromString })
      )
      .addSuccess(ManifestSchema)
      .addError(HttpApiDescriberError)
  )

with address longer than 100 characters, it gives:

RouteNotFound: GET /api/v0/addresses/addr1qyh99v0nhc8e7vcvl3gy8lhwkg7h3ykqgy2nud6gdkdad3fj9q6vf6cgnw48r2ljtmaauxn4s44uuskz3hvggjsslkaqd0rgze?count=10 not found
      at http.server GET
  http.status: 404
  http.method: GET
  http.url: /api/v0/addresses/addr1qyh99v0nhc8e7vcvl3gy8lhwkg7h3ykqgy2nud6gdkdad3fj9q6vf6cgnw48r2ljtmaauxn4s44uuskz3hvggjsslkaqd0rgze?count=10

without changing any code, passing an incorrect address with exactly 100 characters reaches the API Handler.

What is the expected behavior?

No surprise 100-character limit hidden-rule. If there's a limitation with Effect, then there should be an explicit exception mentioning the incapability of processing path params longer than 100 characters instead of RouteNotFound

What do you see instead?

RouteNotFound

Additional information

https://discord.com/channels/795981131316985866/1384171598667317348

ariady-putra avatar Jun 19 '25 13:06 ariady-putra