adonisjs / transmit

A Server-Sent-Event module for AdonisJS
MIT License
71 stars 5 forks source link

transmit authorization always fail #25

Closed EvanPerreau closed 2 months ago

EvanPerreau commented 4 months ago

Package version

1.0.2

Describe the bug

Hello, I have a huge problem with the transmit authorization, I have a authorization for a channel :

image

with this policy (the policy always return true for debug)

image

when i try to connect my front end to the channel

image

but if I directly return true in the channel auth config :

image

it work 🙃

image

Reproduction repo

No response

RomainLanz commented 3 months ago

Hey @EvanPerreau! 👋🏻

Could you please provide a repository with the minimum amount of code to reproduce your issue? As per the Transmit codebase, it should work fine.

EvanPerreau commented 3 months ago

Hey @RomainLanz , I guess this error is throw becasue i don't config the routeHandleModifier in transmit config. But, a new error appear : image image

RomainLanz commented 3 months ago

Are you sure you are not importing the kernel at the top of your file too?

EvanPerreau commented 3 months ago

@RomainLanz it's my transmit.ts config file:

image

and my kernel.ts file : image

RomainLanz commented 3 months ago

You can notice that you are importing the middleware at the top of your file instead of in the callback. Please, check the documentation again.

📚 https://docs.adonisjs.com/guides/digging-deeper/transmit#configuration

EvanPerreau commented 3 months ago

@RomainLanz I also have the error when I import middleware in the callback like the doc : image

image

EvanPerreau commented 3 months ago

server is undefined

RomainLanz commented 3 months ago

That's weird, but let me devise a new way to modify the route. It will solve this issue.

Related: https://github.com/adonisjs/transmit/issues/26

EvanPerreau commented 3 months ago

@RomainLanz ok tank's

EvanPerreau commented 3 months ago

hey @RomainLanz, some good news about your modifications to solve this issue ?

RomainLanz commented 3 months ago

Hey @EvanPerreau! 👋🏻

Could you please try to install @adonisjs/transmit@next and add the following code to your route file:

import transmit from '@adonisjs/transmit/services/main'

transmit.registerRoute(() => {
  // Your route's customization code here
})
RomainLanz commented 2 months ago

Did you have the chance to try the new version? Do you have any feedback or issues before I make a final release?

EvanPerreau commented 2 months ago

Hello, try to use the new version but I was not convinced, i switch to WebSocket