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

When PAM enabled and subscribed with channelGroup throwing Exception RequestFailureException #77

Open
Brinfotech1407 opened this issue Jan 6, 2022 · 6 comments
Assignees
Labels
status: waiting This issue waits for feedback from author.

Comments

@Brinfotech1407
Copy link

Brinfotech1407 commented Jan 6, 2022

Hello I have enabled PAM it works well when I am subscribing through channel Set. Also added retry logic before it's about to expire it works fine though with channel set, but when I am trying to subscribe through channel Group on first instance of it throwing me a following exception.

E/flutter (27374): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: RequestFailureException: request returned non-success status code: 403 E/flutter (27374): #0 new PubNubException (package:pubnub/src/core/exceptions.dart:9:47) E/flutter (27374): #1 new RequestFailureException (package:pubnub/src/core/net/exceptions.dart:28:9) E/flutter (27374): #2 RequestHandler.response (package:pubnub/src/networking/request_handler/io.dart:123:15) E/flutter (27374): <asynchronous suspension> E/flutter (27374): #3 Future.any.onValue (dart:async/future.dart) E/flutter (27374): <asynchronous suspension>

Following is my subscription code on client side.

_channelsSubscription ??= _client!.subscribe(withPresence: withPresence,channelGroups: _channelGroupsSet, );

And Following is my server side code for grantToken.

pubnub.grantToken( { ttl: ttl, resources: { groups: "UUID_cg01":{ read: true, manage: true, } }, );

can you help me here what i am doing wrong here

@Brinfotech1407 Brinfotech1407 changed the title When PAM enable and subscribed with channelGroup throwing Exception 403 When PAM enabled and subscribed with channelGroup throwing Exception RequestFailureException Jan 6, 2022
@mohitpubnub
Copy link
Contributor

Hi @Brinfotech1407

Do you have channels inside mentioned channelGroups ? Possible reason for this error can be - subscribe request ultimately ends up with subscribing no channels (because channelGroup does not contain any member channels so it becomes empty subscription set)

@Brinfotech1407
Copy link
Author

Brinfotech1407 commented Jan 6, 2022 via email

@Brinfotech1407
Copy link
Author

@mohitpubnub can a channel be in a two different channel group ?

@Brinfotech1407
Copy link
Author

image
@mohitpubnub while we were debugging why at subscription via channel group throwing an exception we got to know that subscribe request is using v2/subscribe/ and we are using pubnub SDK ver 4.1.0. And at a time of Reading PAM documentation we got to know that PAM is using v3 so is it fine ?

@mohitpubnub
Copy link
Contributor

mohitpubnub commented Jan 10, 2022

@Brinfotech1407
If I assume
at

_channelsSubscription ??= _client!.subscribe(withPresence: withPresence,channelGroups: _channelGroupsSet, );

withPresence = true,
then
It is trying to subscribe UUID_cg01 channelGroup withPresence

If it is the case then,
It needs read permission on that channelGroup's presence as well. It means here UUID_cg01-pnpres read permission is required.

@mohitpubnub mohitpubnub self-assigned this Jan 10, 2022
@mohitpubnub mohitpubnub added the status: waiting This issue waits for feedback from author. label Jan 10, 2022
@Wing-Li
Copy link

Wing-Li commented Mar 7, 2024

Hi @Brinfotech1407

Do you have channels inside mentioned channelGroups ? Possible reason for this error can be - subscribe request ultimately ends up with subscribing no channels (because channelGroup does not contain any member channels so it becomes empty subscription set)

Does it mean that the message needs to be published first before it can be subscribed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting This issue waits for feedback from author.
Projects
None yet
Development

No branches or pull requests

3 participants