jorgefspereira / plaid_flutter

Plaid Link for Flutter. Integrates the native iOS, Android and Web SDKs.
https://pub.dev/packages/plaid_flutter
MIT License
71 stars 51 forks source link

onExit is not being emitted #134

Open SofiaRey opened 1 month ago

SofiaRey commented 1 month ago

In my project we use Plaid and we encountered an issue:

When triggering the flow to connect a bank account and closing it, it won't send the event of LinkExit

After a quick research and debugging, the issue seems to be in plaid_flutter_web.dart as options.onExit is not being execute. Therefore, no event is sent.

Hope this helps!

jorgefspereira commented 3 weeks ago

@SofiaRey

From your description I'm assuming you expect a LinkExit event when the user closes the bank popup (marked in red):

Screenshot 2024-10-08 at 16 41 11

I assume the LinkExit event is bound to the view with the Link session. Since is an external view it should not trigger the event, according to the documentation:

Note that onExit will not be called when Link is destroyed in some other way than closing Link, such as the user hitting the browser back button or closing the browser tab on which the Link session is present.

Please correct me if I'm misunderstanding you report, or send me a more complete description with video or pictures of the issue.

SofiaRey commented 3 weeks ago

I didn't mean an external view. Here's a video:

https://github.com/user-attachments/assets/012e10fa-7eed-43ef-a38a-743cae98989f

From our side, the Loading State is shown as we never receive the PlaidLinkStateExit from Plaid and as I mentioned before, after debugging we came to the conclusion that options.onExit from your plaid_flutter_web.dart is not being executed. We think it can be related to that, but you'll be able to tell better than us!

Hope this helps and it's clear now.

Let me know if you need any other information.

jorgefspereira commented 3 weeks ago

I have tried in sandbox the same flow and was not able to reproduce the issue. I receive the following exit events:

onEvent: EXIT, metadata: viewName: , exitStatus: institution_not_found, mfaType: , requestId: ZcOF5HYMTXw7tIF, timestamp: 2024-10-08T16:50:48.437Z, linkSessionId: ad2c3fc5-7f11-47d5-8694-203a25ac7cf8, institutionId: , institutionName: , institutionSearchQuery: , errorType: , errorCode: , errorMessage: ,  selection: , routingNumber: , matchReason: , accountNumberMask: 

onExit metadata: status: institution_not_found, linkSessionId: ad2c3fc5-7f11-47d5-8694-203a25ac7cf8, requestId: ZcOF5HYMTXw7tIF, institution.id: , institution.name: , error: null

How are you creating your link token? I created mine with the following options:

{
  "client_id": "...",
  "secret": "....", 
  "user": { "client_user_id": "plaid_user_26" },
  "client_name": "Plaid Flutter",
  "products": [ "auth" ],
  "country_codes": [ "US" ],
  "language": "en",
  "auth": {
      "automated_microdeposits_enabled": true
  }
}
MauriMiguez commented 3 weeks ago

Hi @jorgefspereira! I'm working on the same project as @SofiaRey. Not sure if this helps, but the event seems to not be emitted when the 'X' button is pressed immediately after the flow opens (without pressing 'continue'). However, if the 'X' is pressed after advancing in the flow, the event is emitted correctly.

jorgefspereira commented 3 weeks ago

Hi @MauriMiguez,

Based on your description, it appears that the problem lies within the Plaid SDK itself rather than being related to the Flutter plugin. To address this effectively, please report the issue through the official Plaid channels, specifically their GitHub repository: https://github.com/plaid

I'll keep this issue open so we can both monitor its progress. If you receive any updates or resolutions from the Plaid team, please feel free to share them here.

MauriMiguez commented 3 weeks ago

Just created an issue on the plaid-node repository since the problem was only happening on the web. https://github.com/plaid/plaid-node/issues/648

Juliusman33 commented 1 week ago

it is also happing for flutter ios, but not on android. But I only get this issue when the user is done adding accounts and clicks the 'finished' button. When 'finished' is clicked I get the continue loading indicator of death.

Since I use the multi-product link flow, my current work around is the following. I wait for the webhook from plaid telling me the link session has ended and I notify the user to execute plaid.close() to close the loading indicator of death.

Also tried talking to plaid about it but they referred me here. And this forum is referring us to plaid. So not sure where to go anymore.

Juliusman33 commented 1 week ago

@MauriMiguez Did you figure this out?