Skip to content

MaskErrors does not mask errors for subscriptions #3680

Open

Description

The MaskErrors schema extension does not seem to mask errors for subscriptions. I am running on the latest version of strawberry. Example included below:

from typing import AsyncIterator
import strawberry
from strawberry.extensions import MaskErrors


@strawberry.type
class Query:
    @strawberry.field
    def hello(self) -> str:
        raise Exception("boom")
        return "world"


@strawberry.type
class Subscription:
    @strawberry.subscription
    async def stream(self) -> AsyncIterator[str]:
        yield "hello"
        yield "world"
        raise Exception("boom")


schema = strawberry.Schema(
    query=Query, subscription=Subscription, extensions=[MaskErrors()]
)

The errors are masked for queries:

Image

But not for subscriptions:

Image

Describe the Bug

I expect the MaskErrors extension to mask my errors for subscriptions as well as queries and mutations, but it does not appear to do so.

System Information

  • Operating system: MacOS
  • Strawberry version (if applicable): 0.247.0

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions