Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[types] Invalid type definition for channelAuthorization with customHandler #715

Open
msamsel opened this issue Apr 14, 2023 · 5 comments
Open

Comments

@msamsel
Copy link

msamsel commented Apr 14, 2023

I noticed the issue when I tried to migrate the legacy authorizer to the newer customHandler.
It looks like when I define a customHandler, the type definition still requires providing transport and endpoint fields in channelAuthorization object. It doesn't look as if theses 2 have any purpose. Maybe they should be marked as optional if customeHandler is provided? 🤔

@Vap0r1ze
Copy link

Vap0r1ze commented Jun 14, 2023

i thought this was strange too.. for reference, my client definition looks like this:

export const pusherClient = new PusherClient(process.env.NEXT_PUBLIC_PUSHER_KEY, {
    cluster: process.env.NEXT_PUBLIC_PUSHER_CLUSTER,
    channelAuthorization: {
        endpoint: '', // doesn't seem needed
        transport: 'ajax', // doesn't seem needed
        customHandler: async (channelInfo, callback) => {
            trpcProxy.pusher.authorize.query(channelInfo)
                .then(auth => callback(null, auth))
                .catch(err => callback(err, null));
        },
    },
    userAuthentication: {
        endpoint: '', // doesn't seem needed
        transport: 'ajax', // doesn't seem needed
        customHandler: async ({ socketId }, callback) => {
            trpcProxy.pusher.authenticate.query({ socketId })
                .then(auth => callback(null, auth))
                .catch(err => callback(err, null));
        },
    },
});

@stale
Copy link

stale bot commented Sep 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you'd like this issue to stay open please leave a comment indicating how this issue is affecting you. Thank you.

@stale stale bot added the wontfix label Sep 17, 2023
@bstst
Copy link

bstst commented Sep 19, 2023

same here. need to do this so it does not complain:

image

@stale stale bot removed the wontfix label Sep 19, 2023
@kamalbennani
Copy link

kamalbennani commented Dec 1, 2023

Those fields are indeed not needed, I provided a fix in this PR.

@MeenaAlfons MeenaAlfons mentioned this issue Dec 1, 2023
4 tasks
@kamalbennani
Copy link

kamalbennani commented Dec 6, 2023

This is now fixed in >= v8.4.0-rc2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants