Skip to content

[Bug]: Scratchattach returns a 502 error when trying to use cloud events #559

@G1aD05

Description

@G1aD05

scratchattach version

2.1.13

What happened?

The script fails when it tries to initialize cloud events, I have re-ran my script many times and nothing seems to be working.

Your code.

from huggingface_hub import InferenceClient
import scratchattach as sa

# Logins
client = InferenceClient(api_key="TOKEN")
session = sa.login("USERNAME", "PASSWORD")

# Connections
cloud = session.connect_cloud('ID')
events = cloud.events()


def generate(content: str):
    output = client.chat.completions.create(
        model="meta-llama/Llama-3.1-8B-Instruct",
        messages=[
            {
                "role": "user",
                "content": content
            }
        ]
    )

    return output.choices[0].message


@events.event
def on_set(activity):
    print(activity.var)


events.start()

Traceback

websocket._exceptions.WebSocketBadStatusException: Handshake status 502 Bad Gateway -+-+- {'date': 'Wed, 31 Dec 2025 05:39:48 GMT', 'content-type': 'text/html', 'content-length': '157', 'connection': 'keep-alive', 'server': 'nginx/1.22.1'} -+-+- b'<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.22.1</center>\r\n</body>\r\n</html>\r\n'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs triageNeed to apply low priority/high priority etcbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions