8000 WS in a group merge error · Issue #1237 · elysiajs/elysia · GitHub 8000
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
WS in a group merge error #1237
Closed
Closed
@ShaharIlany

Description

@ShaharIlany

What version of Elysia is running?

1.3.1

What platform is your computer?

Darwin 24.5.0 arm64 arm

What steps can reproduce the bug?

Creating a websocket route inside a group with guard param causes an error on initial startup:

export const app = new Elysia().group("/group", {},(a<
8402
/span>) => // <- With guard param
  a.ws("/ws", {
    open: () => {},
    error: () => {},
    message: () => {},
  })
);

// Error

This issuee occurs only when specifying error handler (error !== undefined).
The following works with no issue:

export const app = new Elysia().group("/group", {},(a) => // <- With guard param
  a.ws("/ws", {
    open: () => {},
    // error: () => {}, <- Error handler is undefined
    message: () => {},
  })
);

// Ok

Using the same exact route without a guard param in the group does work:

export const app = new Elysia().group("/group",(a) => // <- No guard param
  a.ws("/ws", {
    open: () => {},
    error: () => {},
    message: () => {},
  })
);

// Ok

What is the expected behavior?

No response

What do you see instead?

The error:

🦊 Server started at http://localhost:3000
3041 |                                                  error: !localHook.error
3042 |                                                          ? sandbox.event.error
3043 |                                                          : Array.isArray(localHook.error)
3044 |                                                                  ? [
3045 |                                                                                  ...(localHook.error || {}),
3046 |                                                                                  ...(sandbox.event.error || {})
                              ^
TypeError: Spread syntax requires ...iterable[Symbol.iterator] to be a function
      at <anonymous> (/project/workspace/node_modules/elysia/src/index.ts:3046:24)
      at forEach (1:11)
      at group (/project/workspace/node_modules/elysia/src/index.ts:3027:42)
      at autoload (/project/workspace/node_modules/elysia-autoload/dist/index.js:88:16)

Additional information

Codesandbox:
https://codesandbox.io/p/devbox/cocky-cache-ywjnh7

Have you try removing the node_modules and bun.lockb and try again yet?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingreviewWaiting for issue reporter approval

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0