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

Vs Code Extension Error Initializing #5069

Closed
salesforceProDev opened this issue Sep 2, 2023 · 62 comments
Closed

Vs Code Extension Error Initializing #5069

salesforceProDev opened this issue Sep 2, 2023 · 62 comments

Comments

@salesforceProDev
Copy link

Summary

On VScode loading getting this error all the time: Request initialize failed with message: Cannot read properties of undefined (reading 'location') (Lightning Web Components Extension)

Steps To Reproduce:

  1. Open VsCode.
  2. Let the extensions initialize
  3. There is error on the bottom right corner "Request initialize failed with message: Cannot read properties of undefined (reading 'location')"

Expected result

There should be no error the vsCode extensions should initialize without any error

Actual result

Getting error: Request initialize failed with message: Cannot read properties of undefined (reading 'location')

Additional information

Tried to uninstall and install all the extensions back, but didn't work.

Screenshot 2023-09-02 110217

Salesforce Extension Version in VS Code:

salesforce.salesforcedx-vscode-lwc --> version: v58.14.1

SFDX CLI Version:
sfdx-cli/7.209.6 win32-x64 node-v18.15.0

OS and version:
Window 11 64bit

@JsalvaJ
Copy link

JsalvaJ commented Sep 4, 2023

I have the same error. I didn't have it 4 weeks ago. I tried to reinstall the extension package too.
I tried to download the code again and it didn't work.

image

@CristiCanizales
Copy link
Contributor

Hello @salesforceDev-role, @JsalvaJ! Are you also getting this error with v58.14.2? We released it 2 days ago, so can you try updating and check if it is still happening?

@KevinLaurence
Copy link

Hi @CristiCanizales I am also experiencing this issue with version 58.14.2. The extension cannot be updated, and uninstalling and then reinstalling it also does not work. The error message in the log is "ERR CorruptZip: end of central directory record signature not found".

@salesforceProDev
Copy link
Author

Hi @CristiCanizales, Thanks for your response but updating the extension to version v58.14.2, giving the same error message. Attaching the screenshot for your reference.
Lightning_WebComponent extension VsCode Error

@CristiCanizales
Copy link
Contributor

Hi @salesforceDev-role, @KevinLaurence, @JsalvaJ

If you try installing the vsixes at the bottom of this page, do you still get the same error?

To install just go to extensions view, click the 3 dots at the top right of the sidebar, click install from vsixes and select all the files in the zip (previously unzipped):
image

@KevinLaurence
Copy link

Hi @salesforceDev-role, @KevinLaurence, @JsalvaJ

If you try installing the vsixes at the bottom of this page, do you still get the same error?

To install just go to extensions view, click the 3 dots at the top right of the sidebar, click install from vsixes and select all the files in the zip (previously unzipped): image

Yes, the error message was the same:

[error] end of central directory record signature not found: CorruptZip: end of central directory record signature not found

@CristiCanizales
Copy link
Contributor

If you downgrade to previous versions, like v58.13.1 or v58.11.0, do you still get the same error?

@salesforceProDev
Copy link
Author

salesforceProDev commented Sep 13, 2023

@CristiCanizales ,

  1. I've tried downgrading the version of the extension as well to v58.11.0, no change the same error message is popping up my screen. Attaching the screenshot for your reference.
LWC Extension VsCode Lower Version
  1. Tried installing from VSIX, its giving same error message.

@CristiCanizales
Copy link
Contributor

@salesforceDev-role I see.. I believe it's something with your system then, because it's happening with every version, even v58.11.0 which is 3 releases previous to the creation of this issue.

Could you tell me your VS Code version? and also maybe try reinstalling/updating VS Code?

@salesforceProDev
Copy link
Author

@CristiCanizales, Oh ok I'll try to reinstall it, will update you.

Please find the below versions

VSCode : Version: 1.82.1 (user setup)
Electron: 25.8.0
ElectronBuildId: 23503258
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22621

@salesforceProDev
Copy link
Author

@CristiCanizales , reinstalling is not resolving the issue.

Lets assume if this is a system specific issue, but then why does everyone else also have the same concern?

@CristiCanizales
Copy link
Contributor

@salesforceDev-role I know...😓 It's just weird that before v58.14.1 you all were not having issues with previous versions and now you do, and those vsixes for the previous versions didn't change at all... nor anything for the lwc extension

@JsalvaJ, @KevinLaurence would you please tell me your system info too? OS, vscode version, etc

@KevinLaurence
Copy link

@CristiCanizales My system info is as follows:

Version: 1.82.1 (user setup)
Commit: 6509174151d557a81c9d0b5f8a5a1e9274db5585
Date: 2023-09-08T08:45:05.575Z
Electron: 25.8.0
ElectronBuildId: 23503258
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19044

In the last 24 hours I have uninstalled all the Salesforce VS Code extensions and reinstalled an earlier version of VS Code. Then attempted to install the Salesforce Extension Pack, which failed.

I then let VS Code upgrade to the latest version (1.82.1) and again tried to install the SF Extension Pack which failed. Then I installed each extension separately and they all installed successfully, with the exception of the LWC extension again.

So, it seems to me that there is something different about salesforce.salesforcedx-vscode-lwc-58.14.2.vsix compared to the other extension files.

@CristiCanizales
Copy link
Contributor

@KevinLaurence just to confirm, do you have ESLint extension installed and enabled? It's a dependency for LWC extension

@JsalvaJ
Copy link

JsalvaJ commented Sep 14, 2023

Hello @CristiCanizales, here is my system info.
image

@JsalvaJ
Copy link

JsalvaJ commented Sep 14, 2023

I tried to uninstall and reinstall all the things but the error is still ocurring.

@KevinLaurence
Copy link

@KevinLaurence just to confirm, do you have ESLint extension installed and enabled? It's a dependency for LWC extension

@CristiCanizales Yes, I have version 2.4.2 installed and it is enabled.

@KevinLaurence
Copy link

@CristiCanizales I have at least one other colleague who has the same problem with the Lightning Web Components extension and he is running version 58.11.0.

@gianlucaghezzi24
Copy link

I all I have the same problem with the Lightning Web Components extension version v58.14.2 having also the ESLint extension installed version v2.4.2

@salesforceProDev
Copy link
Author

@CristiCanizales what should be done now for the resolution of the same?
Even the same issue I and all my colleagues are facing in their work systems

@SalesforceAlexS
Copy link

Same issue
#5099

@rob-baillie-ortoo
Copy link

Also experiencing this on macOs

@JsalvaJ
Copy link

JsalvaJ commented Sep 19, 2023

Do you know something about it? I reinstalled VSC and extensions and I have the same error. @CristiCanizales do you have any news?
Thks.

@CristiCanizales
Copy link
Contributor

Hello everyone. We're currently digging into this, it's hard because any of us are facing the issue thus we haven't been able to reproduce it. We'll let you know when we have updates! Sorry for the inconveniences

@bobalicious
Copy link

bobalicious commented Sep 20, 2023

Have upgraded Java from:

  • temurin-11
  • jdk-17.0.8
    Issue exists with both.

Error in Extensions Host is:

2023-09-20 08:40:23.500 [error] Error: Request initialize failed with message: Cannot read properties of undefined (reading 'location')
    at be (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/dist/index.js:23:227)
    at Te (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/dist/index.js:22:12217)
    at Immediate.<anonymous> (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/dist/index.js:22:12068)
    at processImmediate (node:internal/timers:476:21)

Previous warnings exist which may not be related:

2023-09-20 08:40:22.488 [warning] [redhat.vscode-xml] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[xml]', provide the URI of a resource or 'null' for any resource.

@bobalicious
Copy link

Full extensions host output - in case it sheds any light:

2023-09-20 08:40:10.335 [info] Extension host with pid 55666 started
2023-09-20 08:40:10.335 [info] Skipping acquiring lock for /Users/xxxx/Library/Application Support/Code/User/workspaceStorage/0801f7ee385f2b392e3a2db3a4de4422.
2023-09-20 08:40:10.501 [info] ExtensionService#_doActivateExtension salesforce.salesforcedx-vscode-apex, startup: false, activationEvent: 'onLanguage:apex-anon'
2023-09-20 08:40:11.922 [warning] DiagnosticCollection with name 'apex-errors' does already exist.
2023-09-20 08:40:11.922 [warning] DiagnosticCollection with name 'apex-errors' does already exist.
2023-09-20 08:40:11.922 [warning] DiagnosticCollection with name 'apex-errors' does already exist.
2023-09-20 08:40:11.926 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage'
2023-09-20 08:40:11.944 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
2023-09-20 08:40:11.946 [info] ExtensionService#_doActivateExtension chuckjonas.apex-pmd, startup: true, activationEvent: '*'
2023-09-20 08:40:11.949 [info] ExtensionService#_doActivateExtension vscode.npm, startup: true, activationEvent: 'workspaceContains:package.json'
2023-09-20 08:40:11.984 [info] ExtensionService#_doActivateExtension salesforce.salesforcedx-vscode-core, startup: true, activationEvent: 'workspaceContains:sfdx-project.json', root cause: salesforce.salesforcedx-einstein-gpt
2023-09-20 08:40:14.019 [info] ExtensionService#_doActivateExtension salesforce.salesforcedx-vscode-lightning, startup: true, activationEvent: 'workspaceContains:sfdx-project.json'
2023-09-20 08:40:15.088 [info] ExtensionService#_doActivateExtension dbaeumer.vscode-eslint, startup: true, activationEvent: 'workspaceContains:sfdx-project.json', root cause: salesforce.salesforcedx-vscode-lwc
2023-09-20 08:40:15.650 [info] ExtensionService#_doActivateExtension salesforce.salesforcedx-vscode-soql, startup: true, activationEvent: 'workspaceContains:sfdx-project.json'
2023-09-20 08:40:16.666 [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
2023-09-20 08:40:16.673 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
2023-09-20 08:40:16.688 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2023-09-20 08:40:16.695 [info] ExtensionService#_doActivateExtension salesforce.salesforcedx-vscode-lwc, startup: true, activationEvent: 'workspaceContains:sfdx-project.json'
2023-09-20 08:40:18.273 [info] ExtensionService#_doActivateExtension redhat.vscode-xml, startup: false, activationEvent: 'api', root cause: salesforce.salesforcedx-vscode-lwc
2023-09-20 08:40:18.433 [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
2023-09-20 08:40:19.855 [info] ExtensionService#_doActivateExtension salesforce.salesforcedx-einstein-gpt, startup: true, activationEvent: 'workspaceContains:sfdx-project.json'
2023-09-20 08:40:20.010 [info] ExtensionService#_doActivateExtension salesforce.salesforcedx-vscode-visualforce, startup: true, activationEvent: 'workspaceContains:sfdx-project.json'
2023-09-20 08:40:20.014 [info] ExtensionService#_doActivateExtension salesforce.salesforcedx-vscode-apex-debugger, startup: true, activationEvent: 'workspaceContains:sfdx-project.json'
2023-09-20 08:40:20.958 [info] ExtensionService#_doActivateExtension salesforce.salesforcedx-vscode-apex-replay-debugger, startup: true, activationEvent: 'workspaceContains:sfdx-project.json'
2023-09-20 08:40:22.252 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2023-09-20 08:40:22.254 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2023-09-20 08:40:22.259 [info] ExtensionService#_doActivateExtension eamodio.gitlens, startup: false, activationEvent: 'onStartupFinished'
2023-09-20 08:40:22.283 [info] ExtensionService#_doActivateExtension esbenp.prettier-vscode, startup: false, activationEvent: 'onStartupFinished'
2023-09-20 08:40:22.301 [info] ExtensionService#_doActivateExtension GitHub.copilot, startup: false, activationEvent: 'onStartupFinished'
2023-09-20 08:40:22.338 [info] ExtensionService#_doActivateExtension GitHub.copilot-labs, startup: false, activationEvent: 'onStartupFinished'
2023-09-20 08:40:22.428 [info] ExtensionService#_doActivateExtension shardulm94.trailing-spaces, startup: false, activationEvent: 'onStartupFinished'
2023-09-20 08:40:22.476 [warning] [redhat.vscode-xml] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[xml]', provide the URI of a resource or 'null' for any resource.
2023-09-20 08:40:22.480 [warning] [redhat.vscode-xml] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[xml]', provide the URI of a resource or 'null' for any resource.
2023-09-20 08:40:22.488 [warning] [redhat.vscode-xml] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[xml]', provide the URI of a resource or 'null' for any resource.
2023-09-20 08:40:23.417 [info] ExtensionService#_doActivateExtension ms-vsliveshare.vsliveshare, startup: false, activationEvent: 'api', root cause: eamodio.gitlens
2023-09-20 08:40:23.500 [error] Error: Request initialize failed with message: Cannot read properties of undefined (reading 'location')
    at be (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/dist/index.js:23:227)
    at Te (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/dist/index.js:22:12217)
    at Immediate.<anonymous> (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/dist/index.js:22:12068)
    at processImmediate (node:internal/timers:476:21)
2023-09-20 08:40:25.809 [info] Eager extensions activated

@pavan00089
Copy link

pavan00089 commented Sep 20, 2023

Even I am also experiencing the same issue.

Below steps I have followed but still I see the error.

  1. I have updated vs code to latest version.
  2. Updated sfdx to latest version
  3. Uninstalled the extension pack and re-installed again.
  4. Updated Jdk to latest version.

VS_Error

@JsalvaJ
Copy link

JsalvaJ commented Oct 4, 2023

Hello @CristiCanizales it seems that it works good. I don't have the issue when VS starts.
Thanks a lot!

@KevinLaurence
Copy link

Thanks @CristiCanizales I can confirm that the latest version of the extension installed in VS Code successfully.

@bobalicious
Copy link

@CristiCanizales - Sorry, I've not been able to install the upgrade linked from this issue - has this fix gone into the latest versions yet? I see a new version was released yesterday.

If so, the problem still occurs for me.

@bobalicious
Copy link

bobalicious commented Oct 6, 2023

Running version 58.16.0

Errors in extension host:

2023-10-06 10:36:36.972 [error] Error: Request initialize failed with message: Cannot read properties of undefined (reading 'location')
    at be (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/dist/index.js:23:227)
    at Te (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/dist/index.js:22:12217)
    at Immediate.<anonymous> (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/dist/index.js:22:12068)
    at processImmediate (node:internal/timers:476:21)

@Razvan-Racolta
Copy link

I have the same issue. I downloaded the .zip file for salesforcedx-vscode-lwc-58.15.0.zip, renamed the extension to vsix, installed it and after vs code restart, the error is still there. After extension update, the issue is still there.

Should this issue be reopened?

Thank you kindly @CristiCanizales

@github-actions
Copy link

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

@github-actions github-actions bot added the stale label Oct 18, 2023
@JsalvaJ
Copy link

JsalvaJ commented Oct 18, 2023

Hello, I'm continuing having the same issue. I installed the last version v59 and the same message is fired for me.

mainThreadExtensionService.ts:81 [salesforce.salesforcedx-vscode-lwc]Request initialize failed with message: Cannot read properties of undefined (reading 'location')
$onExtensionRuntimeError @ mainThreadExtensionService.ts:81
mainThreadExtensionService.ts:82 Error: Request initialize failed with message: Cannot read properties of undefined (reading 'location')
at be (.vscode\extensions\salesforce.salesforcedx-vscode-lwc-59.0.0\dist\index.js:23:227)
at Te (.vscode\extensions\salesforce.salesforcedx-vscode-lwc-59.0.0\dist\index.js:22:12217)
at Immediate. (.vscode\extensions\salesforce.salesforcedx-vscode-lwc-59.0.0\dist\index.js:22:12068)
at process.processImmediate (node:internal/timers:476:21)

@CristiCanizales this is solved for everyone? I tried it few days ago and it seems that works good but not...

@bobalicious
Copy link

@CristiCanizales - this ticket has had the label 'stale' added to it - and whilst the ticket may have had a low level replies from yourselves over the last week or so, it is still my understanding that it is active and should remain open. Can the label be removed?

@CristiCanizales
Copy link
Contributor

@JsalvaJ It was supposed to be solved but now it seems like it isn't. We're still investigating and will update once we have a new fix!

@gbockus-sf gbockus-sf self-assigned this Oct 18, 2023
@gbockus-sf
Copy link
Contributor

Howdy @bobalicious @JsalvaJ @Razvan-Racolta
I built a debug version of the LWC extension with logging around when a location property is accessed. If you could download from my fork and attempt to generate the debug logging to give us an idea of where the failure is occurring that would be awesome. Find instructions and vsix in the below release.
https://github.com/gbockus-sf/salesforcedx-vscode/releases/tag/0.0.3

I'm pretty sure the issue is something about how exports are structured, but haven't been able to repo based on the LayoutConstants example above.

Thanks for your patience on this.

@bobalicious
Copy link

@gbockus-sf
Copy link
Contributor

gbockus-sf commented Oct 23, 2023

Thanks for the log @bobalicious
Comparing it to my run locally I needed to add more info to the logs to find out where exactly the error is occurring. It appears to be making it all the way through the property and method analysis.

I uploaded a new version of the vsix here If you could send me those logs that'd be awesome.

Also if you could email me (gbockus@salesforce.com) the LWC that is resulting in the error and I could try to repo locally that'd speed this along for sure

   "name": "LoadEntityForm",
    "id": "Class#LoadEntityForm#15",

If not possible I totally get that.
Thanks!

@bobalicious
Copy link

It'll be a few days before I'll be able to do that, but I will certainly try.

Knowing which LWC is causing the problem to appear, I may be able to reduce the test case and provide a version that is less, shall we say, private. I'll catch up with this again next week.

@bobalicious
Copy link

Reproduction using the new VSIX

With the version referenced above installed, I do not get an 'LWC Language Server' output window.

There is an 'LWC Extension' output window that contains no logs whatsoever.

I can see no other output windows that contain any debug logs of the type you are looking for.

The 'Extension Host' output window contains:

2023-10-30 11:10:04.500 [error] Error: Request initialize failed with message: Cannot read properties of undefined (reading 'location')
    at handleResponse (/Users/xxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-59.0.1/dist/index.js:8728:40)
    at processMessageQueue (/Users/xxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-59.0.1/dist/index.js:8583:13)
    at Immediate.<anonymous> (/Users/xxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-59.0.1/dist/index.js:8569:11)
    at processImmediate (node:internal/timers:476:21)

Replication using the LoadEntityForm LWC

I have attempted to replicate the issue using only the LoadEntityForm LWC and it does not occur with that LWC, and so I am not forwarding it on to you.

@bobalicious
Copy link

bobalicious commented Oct 30, 2023

@gbockus-sf / @CristiCanizales - I believe I've found the shape of LWC that causes the issue.

It is a pattern where you create a setter but no corresponding getter.

  1. Create a new LWC
  2. Add a property
  3. Add a setter for that property with a slightly different name
  4. DO NOT add a getter
  5. Save
  6. Witness the crash

E.g. an LWC that consists solely of the following:

import { LightningElement } from 'lwc';

export default class PropertySetterWithNoGetter extends LightningElement {

    _property = '';
    set property( value ) {
        this._property = value;
    }
}

Please do not discuss as to why this would be desirable - it is a perfectly valid block of code and I am aware that there are other ways of doing the same thing. This example exists purely to show how to get the Lightning Web Components extension to crash.

(Note: this pattern did not exist in LoadEntityForm, it was in an entirely different LWC, so I'm not sure what happened with the logging)

@gbockus-sf
Copy link
Contributor

💥 Thanks @bobalicious I repo'd locally and will see what we can do to get it resolved.

@git2gus
Copy link

git2gus bot commented Oct 30, 2023

This issue has been linked to a new work item: W-14391061

@gbockus-sf
Copy link
Contributor

Fixed with the 59.3.1 Release. Thanks for working with us to get this issue resolved. 🥳 🎉

@bobalicious
Copy link

Confirmed as fixed from my perspective

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

No branches or pull requests