yannick-beot-sp / vscode-sailpoint-identitynow

Visual Studio Code extension for SailPoint IdentityNow
MIT License
32 stars 17 forks source link

"Fetch failed" error after updating VSCode to latest version #50

Closed eabedrapo closed 11 months ago

eabedrapo commented 1 year ago

Describe the bug All operations with the extension fail with "Fetch failed" error after updating to the latest VSCode version.

I removed the tenant thinking that it would get resolved by adding the tenant again, but it's not even allowing me to do so. I tried to add the tenant using the temporary Access Tokens that expire after 10 minutes, and although it allowed me to add the tenant, I still get "Fetch failed" when trying to access anything in there.

To Reproduce Steps to reproduce the behavior:

  1. VSCode to v.1.82.2
  2. Open VSCode and open the IDN extension
  3. Try to open any source, transform, identity profile, etc.
  4. See "Fetch failed" error at the bottom right of the screen.
  5. (optional) Remove the tenant and try to configure it again.

Expected behavior The extension should be able to connect to the tenant, read the objects supported by the plugin and persist changes made to files, as it was behaving before updating VSCode to the latest version.

Additional context For more details on this failure, please refer to my detailed post at https://developer.sailpoint.com/discuss/t/identitynow-extensions-for-visual-studio-code/5983/38?u=eabedrapo1

Thanks!

yannick-beot-sp commented 1 year ago

Hi @eabedrapo Thanks for opening this issue. I was not able to reproduce exactly your issue. I have a "fetch failed" error for SP-Config import but never to get stuff like a transform or an identity profile. I tried to fix things. Can you download the following zip file, change the extension to .vsix and install it by going to the extension menu (Press Ctrl+Shift+X) and in the menu, click Install from VSIX.... You may need to remove the other one.

vscode-sailpoint-identitynow-0.0.20.zip

eabedrapo commented 12 months ago

Hi @yannick-beot-sp, apologies, yesterday we had a big deploy to prod that consumed most of my day and today I’m attending a security event out of the office (I’m posting this from my mobile). Tomorrow I’ll try to test with that library and I’ll send you my results. I appreciate the effort, I now that contributing to OSS isn’t easy, so I’ll do my best to help. Keep in touch!

eabedrapo commented 12 months ago

hi @yannick-beot-sp unfortunately the new extension didn't resolve the problem with my VSCode (uninstalled, installed and reloaded VSCode and it didn't work). I'll try reinstalling VSCode from scratch this afternoon and I'll let you know if that helps. Thanks for your patience.

CraigHf commented 12 months ago

Hi guys,

@yannick-beot-sp , just letting you know that I'm having the same problem as @eabedrapo here. I've tried to do a fresh install of VSCode along with the extension you provided above, but no success... I'm still facing the "fetch failed" problem... Can't even add a tenant...

Thanks in advance,

Bert.

eabedrapo commented 12 months ago

Hi @yannick-beot-sp, I spent some time debugging this error and I found 2 things:

  1. I was able to add a tenant by using the following URL available in your documentation:
    vscode://yannick-beot-sp.vscode-sailpoint-identitynow/addtenant?tenantName=xxx&clientId=myClientID&clientSecret=mySecret&authenticationMethod=PersonalAccessToken
  2. The "fetch failed" error keeps happening on all API request, and after looking at the following trace, I think the problem is with the script that retrieves the JWT when passing my PAT key pair (check last 3 lines right above the error trace)
    
    console.ts:137
    [Extension Host] > IdentityNowDataProvider.refresh
    [Extension Host] > getTreeItem {collapsibleState: 1, label: 'Sources', tenantId: 'yyy', tenantName: 'xxx.identitynow.com', tenantDisplayName: 'xxx', …}
    [Extension Host] after update {collapsibleState: 1, label: 'Sources', tenantId: 'yyy', tenantName: 'xxx.identitynow.com', tenantDisplayName: 'xxx', …}
    [Extension Host] > getChildren  {collapsibleState: 1, label: 'Sources', tenantId: 'yyy', tenantName: 'xxx.identitynow.com', tenantDisplayName: 'xxx', …}
    [Extension Host] > getSources
    [Extension Host] endpoint = https://xxx.api.identitynow.com/v3/sources?count=true&limit=250&sorters=name
    [Extension Host] > getSessions ['yyy']
    [Extension Host] > getSessionByTenant yyy
    [Extension Host] WARNING: no token for tenant yyy
    [Extension Host] INFO: accessToken is expired. Updating Access Token
    [Extension Host] > createAccessToken xxx.identitynow.com myClientID

notificationsAlerts.ts:40 TypeError: fetch failed at Object.fetch (node:internal/deps/undici/undici:11413:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async fr.createAccessToken ({myDrive}.vscode\extensions\yannick-beot-sp.vscode-sailpoint-identitynow-0.0.20\out\extension.js:535:18479) at async fr.getSessionByTenant ({myDrive}.vscode\extensions\yannick-beot-sp.vscode-sailpoint-identitynow-0.0.20\out\extension.js:535:17060) at async fr.getSessions ({myDrive}.vscode\extensions\yannick-beot-sp.vscode-sailpoint-identitynow-0.0.20\out\extension.js:535:16329)


I tested again with Postman and I don't have this problem, however I do have the pre-request script running behind the scenes, which generates a JWT out from my PAT.

I hope this helps,

Elisa.
yannick-beot-sp commented 12 months ago

Unfortunately, I cannot reproduce this issue :( I tried to remove a tenant and start from scratch to see if the Access Token is properly retrieved and it does. I rely on a library to manage the OAuth part to get an Access Token. I will try to rewrite this to get control on the "fetch" method.

yannick-beot-sp commented 12 months ago

Here is a new version that changes the code for authentication. Can you try this one @eabedrapo ? vscode-sailpoint-identitynow-0.0.20.zip

eabedrapo commented 12 months ago

Hi @yannick-beot-sp, there is some progress: I was now able to add the tenant, but still getting "fetch failed" when trying to open any of the components available with the extension (e.g. Sources, Transforms, etc).

The following is the trace from the DevTools console when I try to open the Sources node:

console.ts:137
[Extension Host] > IdentityNowDataProvider.refresh
[Extension Host] > getTreeItem {collapsibleState: 1, label: 'Sources', tenantId: 'yyy', tenantName: 'xxx.identitynow.com', tenantDisplayName: 'xxx', …}
[Extension Host] after update {collapsibleState: 1, label: 'Sources', tenantId: 'yyy', tenantName: 'xxx.identitynow.com', tenantDisplayName: 'xxx', …}
[Extension Host] > getChildren  {collapsibleState: 1, label: 'Sources', tenantId: 'yyy', tenantName: 'xxx.identitynow.com', tenantDisplayName: 'xxx', …}
[Extension Host] > getSources
[Extension Host] endpoint = https://xxx.api.identitynow.com/v3/sources?count=true&limit=250&sorters=name
[Extension Host] > getSessions ['yyy']
[Extension Host] > getSessionByTenant yyy
[Extension Host] < getSessionByTenant existing token
[Extension Host] < getSessions

notificationsAlerts.ts:40
TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11413:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async z.getSources ({myDrive}\.vscode\extensions\yannick-beot-sp.vscode-sailpoint-identitynow-0.0.20\out\extension.js:527:33464)
    at async yu.getChildren ({myDrive}\.vscode\extensions\yannick-beot-sp.vscode-sailpoint-identitynow-0.0.20\out\extension.js:528:5144)
    at async _a.getChildren ({myDrive}\.vscode\extensions\yannick-beot-sp.vscode-sailpoint-identitynow-0.0.20\out\extension.js:528:21494)
    at async w.S ({VSCodeInstallationFolder}\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:107:16280)
    at async w.getChildren ({VSCodeInstallationFolder}\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:107:12650)

I hope this gives you some pointers what to check next. Feel free to add more verbose logs that I could hopefully capture via DevTools to share with you here.

Thanks for your time looking into this!

Elisa.

yannick-beot-sp commented 11 months ago

Yes and no unfortunately. It means that "fetch" is in cause, and I replaced it by axios. However:

  1. It does not fail like this on my computer, even though we share the same environment on the paper
  2. I have to rewrite every call to IDN to get rid of fetch
conchchow commented 11 months ago

Facing the same issue "Fetch Failed". started just after I updated the VSCode to latest version "v.1.82.2". What a pain ..

But found a workaround. Reinstall VSCode to May 2023 release ( 1.79.2) [https://code.visualstudio.com/updates/v1_79] (Disable the Auto update setting in the VSCode, so that no new update get install automatically.) Uninstall and Reinstall Latest IdentityNow extension from the VSCode itself, not the ZIP one from GIT. Delete any exiting preconfigured Tenant in VSCode, and add tenant again.

mark-spain-bayer commented 11 months ago

Hello - This is also happening to me now. VSCode v1.82.2, extension v0.0.19.

eabedrapo commented 11 months ago

Hi @yannick-beot-sp, as you may have seen in the SailPoint Developers community forums, the workaround that Shankhabrata Chowdhury posted a couple of days ago worked like a charm.

Feel free to keep this issue open if you'd like to fix this on the next release of your extension, as staying on this older VSCode version for too long won't be ideal (hopefully the developers of the library you're using release a patch soon!).

By the way, have you opened any issues to them to track this problem? If so, can you share the link to the issue? I'm happy to provide my feedback if they need to.

Thank you very much!!

yannick-beot-sp commented 11 months ago

Hi, Here is a new version which rewrite complety all API calls. vscode-sailpoint-identitynow-0.0.20.zip

Please give it a try. I tried as much as possible to test to prevent regression but I cannot be affirmative.

gwhip70 commented 11 months ago

Hi, Here is a new version which rewrite complety all API calls. vscode-sailpoint-identitynow-0.0.20.zip

Please give it a try. I tried as much as possible to test to prevent regression but I cannot be affirmative.

@yannick-beot-sp,

Hello, I'm fairly new to VSCode and use it mainly for your extension, I've always used another paid for editor. How do you apply this update manually? I'm not seeing where to extract this in the file system for every profile (globally) since there isn't a file with the vsix extension.

Thanks, Kelvin

yannick-beot-sp commented 11 months ago

I cannot upload a vsix file. Just change the extension from .zip to .vsix.

Le mar. 3 oct. 2023 à 19:18, Kelvin Whipple @.***> a écrit :

Hi, Here is a new version which rewrite complety all API calls. vscode-sailpoint-identitynow-0.0.20.zip https://github.com/yannick-beot-sp/vscode-sailpoint-identitynow/files/12784736/vscode-sailpoint-identitynow-0.0.20.zip

Please give it a try. I tried as much as possible to test to prevent regression but I cannot be affirmative.

@yannick-beot-sp https://github.com/yannick-beot-sp,

Hello, I'm fairly new to VSCode and use it mainly for your extension, I've always used another paid for editor. How do you apply this update manually? I'm not seeing where to extract this in the file system for every profile (globally) since there isn't a file with the vsix extension.

Thanks, Kelvin

— Reply to this email directly, view it on GitHub https://github.com/yannick-beot-sp/vscode-sailpoint-identitynow/issues/50#issuecomment-1745404652, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATUL7LR7QYEU6MH5G7QHIGTX5RCHLAVCNFSM6AAAAAA45LZW42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBVGQYDINRVGI . You are receiving this because you were mentioned.Message ID: @.*** com>

gwhip70 commented 11 months ago

The update 0.0.20 is allowing me to connect again. Thanks so much!

yannick-beot-sp commented 11 months ago

Thank you for your feedback. I'll wait until end of week to publish this version.

Le mar. 3 oct. 2023 à 21:52, Kelvin Whipple @.***> a écrit :

The update 0.0.20 is allowing me to connect again. Thanks so much!

— Reply to this email directly, view it on GitHub https://github.com/yannick-beot-sp/vscode-sailpoint-identitynow/issues/50#issuecomment-1745627372, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATUL7LUOQGPGHWHOCQZDP7TX5RUHPAVCNFSM6AAAAAA45LZW42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBVGYZDOMZXGI . You are receiving this because you were mentioned.Message ID: @.*** com>

eabedrapo commented 11 months ago

Hi, Here is a new version which rewrite complety all API calls. vscode-sailpoint-identitynow-0.0.20.zip

Please give it a try. I tried as much as possible to test to prevent regression but I cannot be affirmative.

Hi @yannick-beot-sp, apologies, I got sick on Monday and yesterday I had a very busy day at work. I'm updating my VSCode to the latest version now and I just confirmed the extension 0.0.19 started failing again.

Replacing it with the new version you just released. Fingers crossed I get same successful results that @gwhip70 reported after his testing!!!

UPDATE

You're a genius @yannick-beot-sp!!! It worked like a charm! I had to re-authenticate with my PAT to the tenant, of course but you made it!

Tested with VSCode v.1.82.3 (latest version).

Thank you very much!!!!

Feel free to close this thread now.

yannick-beot-sp commented 11 months ago

Thank you for testing and for your patience @eabedrapo. I'll release tomorrow and close this issue

emarks918 commented 11 months ago

I’m still getting an error with V0.0.20 (Preview) when using a FQDN.

Entering: .api.identitynow.com

gives the following error which looks like it has an extra “.api” included in the middle of the URL.

Error: getaddrinfo ENOTFOUND <tenantname.api.api.identitynow.com

Ed Marks, CISSP, CCSP

From: yannick-beot-sp @.> Sent: Wednesday, October 4, 2023 3:20 PM To: yannick-beot-sp/vscode-sailpoint-identitynow @.> Cc: Subscribed @.***> Subject: Re: [yannick-beot-sp/vscode-sailpoint-identitynow] "Fetch failed" error after updating VSCode to latest version (Issue #50)

Thank you for testing and for your patience @eabedrapohttps://github.com/eabedrapo. I'll release tomorrow and close this issue

— Reply to this email directly, view it on GitHubhttps://github.com/yannick-beot-sp/vscode-sailpoint-identitynow/issues/50#issuecomment-1747580054, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYSJ5K3IKEBW2NZEQEXNQLTX5XAGPAVCNFSM6AAAAAA45LZW42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXGU4DAMBVGQ. You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

yannick-beot-sp commented 11 months ago

FQDN must be entered without "api" in it. For IdentityNow.com tenant, tenant's name is enough.

Le jeu. 5 oct. 2023 à 00:15, Ed Marks @.***> a écrit :

I’m still getting an error with V0.0.20 (Preview) when using a FQDN.

Entering: .api.identitynow.com

gives the following error which looks like it has an extra “.api” included in the middle of the URL.

Error: getaddrinfo ENOTFOUND <tenantname.api.api.identitynow.com

Ed Marks, CISSP, CCSP

From: yannick-beot-sp @.> Sent: Wednesday, October 4, 2023 3:20 PM To: yannick-beot-sp/vscode-sailpoint-identitynow @.> Cc: Subscribed @.***> Subject: Re: [yannick-beot-sp/vscode-sailpoint-identitynow] "Fetch failed" error after updating VSCode to latest version (Issue #50)

Thank you for testing and for your patience @eabedrapo< https://github.com/eabedrapo>. I'll release tomorrow and close this issue

— Reply to this email directly, view it on GitHub< https://github.com/yannick-beot-sp/vscode-sailpoint-identitynow/issues/50#issuecomment-1747580054>, or unsubscribe< https://github.com/notifications/unsubscribe-auth/AYSJ5K3IKEBW2NZEQEXNQLTX5XAGPAVCNFSM6AAAAAA45LZW42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXGU4DAMBVGQ>.

You are receiving this because you are subscribed to this thread.Message ID: @.**@.>>

— Reply to this email directly, view it on GitHub https://github.com/yannick-beot-sp/vscode-sailpoint-identitynow/issues/50#issuecomment-1747722343, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATUL7LT3HYE5QS3WTRAIG3DX5XNW3AVCNFSM6AAAAAA45LZW42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXG4ZDEMZUGM . You are receiving this because you were mentioned.Message ID: @.*** com>