Closed salesforceProDev closed 1 year ago
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.
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?
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".
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.
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):
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):
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
If you downgrade to previous versions, like v58.13.1 or v58.11.0, do you still get the same error?
@CristiCanizales ,
@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?
@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
@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?
@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
@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.
@KevinLaurence just to confirm, do you have ESLint extension installed and enabled? It's a dependency for LWC extension
Hello @cristiCanizales, here is my system info.
I tried to uninstall and reinstall all the things but the error is still ocurring.
@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.
@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.
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
@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
Also experiencing this on macOs
Do you know something about it? I reinstalled VSC and extensions and I have the same error. @CristiCanizales do you have any news? Thks.
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
Have upgraded Java from:
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.
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
Even I am also experiencing the same issue.
Below steps I have followed but still I see the error.
@CristiCanizales We are having this issue also. I was able to reproduce this issue in a freshly generated project. The extension crashes when there is another javascript file in a LWC component that references window.location
. There might be other APIs that cause the language server to crash, not just window.location
.
Steps to reproduce:
window.location
window.location
like window.location.href
. LWC extension should now crash.Language server output
TypeError: Cannot read properties of undefined (reading 'location')
at mapLwcMetadataToInternal (/Users/.../.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/type-mapping.js:428:188)
at compileSource (/Users/..../.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/compiler.js:172:66)
at compileDocument (/Users/.../.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/compiler.js:184:12)
at Server.onDidChangeContent (/Users/.../.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/lwc-server.js:195:84)
Node.js v18.15.0
[Info - 22:33:22] Connection to server got closed. Server will restart.
/Users/.../.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/type-mapping.js:428
const declarationLoc = externalToInternalLoc((_a = defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport.location) !== null && _a !== void 0 ? _a : mainClassObj.location);
^
TypeError: Cannot read properties of undefined (reading 'location')
at mapLwcMetadataToInternal (/Users/.../.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/type-mapping.js:428:188)
at compileSource (/Users/..../.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/compiler.js:172:66)
at compileDocument (/Users/..../.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/compiler.js:184:12)
at Server.onDidChangeContent (/Users/.../.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/lwc-server.js:195:84)
Node.js v18.15.0
[Error - 22:33:23] Connection to server got closed. Server will not be restarted.
Edited: Typos...
OS: macOs 13.5.2 (22G91) extension version: v58.14.2
Following @WuggyX2 's post, commented out all references to window.
and location
in a codebase does not resolve the issue. It may be a trigger for the error, but it appears to not be the only one.
Also, creating an empty additional JS file anywhere in the lwc folder causes the following:
/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/type-mapping.js:428
const declarationLoc = externalToInternalLoc((_a = defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport.location) !== null && _a !== void 0 ? _a : mainClassObj.location);
^
TypeError: Cannot read properties of undefined (reading 'location')
at mapLwcMetadataToInternal (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/type-mapping.js:428:188)
at compileSource (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/compiler.js:172:66)
at compileDocument (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/compiler.js:184:12)
at Server.onDidChangeContent (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/lwc-server.js:195:84)`
Also, if I create a headless LWC I get an issue.
const DISPLAY_DENSITY = Object.freeze({
COMFY : 'comfy',
COMPACT : 'compact',
DEFAULT : 'comfy',
});
const getKeyForDisplayDensity = displayDensity => {
for ( let key in DISPLAY_DENSITY ) {
if ( DISPLAY_DENSITY[ key ] === displayDensity ) {
return key;
}
}
return '';
}
const LABEL_PROPERTIES = Object.freeze({
COMFY : {
VARIANT : 'standard',
CLASSES : 'slds-form-element slds-form-element_stacked'
},
COMPACT : {
VARIANT : 'label-inline',
CLASSES : 'slds-form-element slds-form-element_horizontal'
},
HIDDEN : {
VARIANT : 'label-hidden',
CLASSES : ''
},
});
const CONSTANTS = Object.freeze({
DISPLAY_DENSITY : DISPLAY_DENSITY,
LABEL_PROPERTIES : LABEL_PROPERTIES,
getLabelVariant : displayDensity => LABEL_PROPERTIES[ getKeyForDisplayDensity( displayDensity ) ].VARIANT,
getLabelClasses : displayDensity => LABEL_PROPERTIES[ getKeyForDisplayDensity( displayDensity ) ].CLASSES
});
export default CONSTANTS;
Immediate crash before save:
/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/type-mapping.js:373
methodLocs, } = getDecoratedMethods(classObj.methods);
^
TypeError: Cannot read properties of undefined (reading 'methods')
at getDecorators (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/type-mapping.js:373:50)
at mapLwcMetadataToInternal (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/type-mapping.js:430:21)
at compileSource (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/compiler.js:172:66)
at compileDocument (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/javascript/compiler.js:184:12)
at Server.onDidChangeContent (/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.14.2/node_modules/@salesforce/lwc-language-server/lib/lwc-server.js:195:84)
I suspect that these are all related to the fact that the LWC language server is very strict about the shape of LWC it expects and doesn't handle LWCs that are actually modules, or have additional JS files in them.
I've updated the Lightning Web Components extension to version v58.15.0 but the error is still there
Hello everyone, could you please try installing the vsixes at the bottom of this page, restart vscode and check if the issue persists?
To install vsixes you need to go to the extensions view, click the 3 dots in the action menu, select Install from vsixes and select them:
@CristiCanizales after updating the LWC extension from the VSIX the error stopped popping. I wasn't able to install all of them because there were some installation errors.
Hi @salesforceDev-role, @KevinLaurence, @JsalvaJ, @gianlucaghezzi24, @SalesforceAlexS, @rob-baillie-ortoo, @bobalicious, @pavan00089, @WuggyX2! Could you all please do the same (install VSIX for salesforce.salesforcedx-vscode-lwc extension which you can find at the bottom of this page, restart vscode and check if the issue persists)? Thanks in advance!
Hi @salesforceDev-role, @KevinLaurence, @JsalvaJ, @gianlucaghezzi24, @SalesforceAlexS, @rob-baillie-ortoo, @bobalicious, @pavan00089, @WuggyX2! Could you all please do the same (install VSIX for salesforce.salesforcedx-vscode-lwc extension which you can find at the bottom of this page, restart vscode and check if the issue persists)? Thanks in advance!
I cannot download the file. Don't know why.
Hello @CristiCanizales, I did try as you asked to download the mentioned extension file and install it. It seems to be working as expected, I am not getting that failed to initialize message anymore👍. But will it be resolved with the upcoming versions of the extensions? Happy Friday
Hello @salesforceDev-role, great! And yes, of course! It will go out in our next release (next wednesday/thursday). Thanks for your patience all this time and sorry for the inconveniences. Happy friday!
@KevinLaurence Here's the .zip file for salesforcedx-vscode-lwc-58.15.0.zip. Just change the extension to .vsix and try installing it.
@CristiCanizales, Thanks for all your help, appreciate it.
@CristiCanizales I also tested the updated extension and can confirm that the language server no longer crashes when there are additional JS modules in a same file.
Closing this issue after confirmation from different users that the fix works. Thanks @divmain for the fix! 🥳
@CristiCanizales Help me out here If I am doing something wrong.
1) I download the zip from the link then extracted it.
2) Then I renamed extension.vsixmanifest file to extension.vsixmanifest.vsix.
3) Then I tried to Install that manually but getting below error.
Hello @CristiCanizales it seems that it works good. I don't have the issue when VS starts. Thanks a lot!
Thanks @CristiCanizales I can confirm that the latest version of the extension installed in VS Code successfully.
@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.
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)
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
This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.
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.
@CristiCanizales this is solved for everyone? I tried it few days ago and it seems that works good but not...
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:
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.
Salesforce Extension Version in VS Code:
SFDX CLI Version: sfdx-cli/7.209.6 win32-x64 node-v18.15.0
OS and version: Window 11 64bit