Description
The Puppet extension (v1.5.5) fails to activate on VS Code 1.113, resulting in broken syntax highlighting and all language features being unavailable.
Root Cause
VS Code 1.113 ships with a newer Node.js version that exposes navigator as a global object via a Proxy. When extension code accesses navigator, VS Code throws a PendingMigrationError (see https://aka.ms/vscode-extensions/navigator).
Two dependencies in the extension trigger this error:
axios (including v1.9.0) — accesses navigator at dist/node/axios.cjs line const _navigator = typeof navigator === 'object' && navigator || undefined;. The typeof check returns 'object' (the Proxy exists), but the subsequent property access triggers the error.
@microsoft/applicationinsights-web-basic — accesses navigator via getNavigator() for telemetry
Note: Updating axios to 1.9.0 does NOT fix the issue — axios 1.9.0 still accesses navigator the same way.
Error Logs
From remoteexthost.log:
ExtensionService#_doActivateExtension puppet.puppet-vscode, startup: false, activationEvent: 'onLanguage:puppet'
[error] PendingMigrationError: navigator is now a global in nodejs, please see https://aka.ms/vscode-extensions/navigator for additional info on this error.
at Object.<anonymous> (/home/user/.vscode-server/extensions/puppet.puppet-vscode-1.5.5/node_modules/axios/dist/node/axios.cjs:1310:20)
at Object.<anonymous> (/home/user/.vscode-server/extensions/puppet.puppet-vscode-1.5.5/out/forge.js:5:17)
at Object.<anonymous> (/home/user/.vscode-server/extensions/puppet.puppet-vscode-1.5.5/out/feature/PuppetfileCompletionFeature.js:14:17)
at Object.<anonymous> (/home/user/.vscode-server/extensions/puppet.puppet-vscode-1.5.5/out/extension.js:21:39)
Impact
- No syntax highlighting for
.pp and .epp files
- No language server features (completion, hover, go-to-definition)
- Extension completely non-functional
Workaround
Manually patch the two files in the extension's node_modules:
1. Patch axios (node_modules/axios/dist/node/axios.cjs):
- const _navigator = typeof navigator === 'object' && navigator || undefined;
+ const _navigator = undefined;
2. Patch applicationinsights-web-basic (node_modules/@microsoft/applicationinsights-web-basic/dist/es5/applicationinsights-web-basic.js):
function getNavigator() {
- !_globalLazyTestHooks && _initTestHooks();
- (!_cachedNavigator || _globalLazyTestHooks.lzy) && (_cachedNavigator = createCachedValue(safe((getInst), ["navigator"]).v));
- return _cachedNavigator.v;
+ return NULL_VALUE;
}
Then reload VS Code (Ctrl+Shift+P → "Reload Window").
Note: This workaround is local and will be overwritten if the extension updates.
Suggested Fix
- Update
axios to a version that does not access the navigator global (or guard the access with a try/catch)
- Update
@microsoft/applicationinsights-web-basic / @vscode/extension-telemetry to a version compatible with VS Code 1.113's navigator Proxy
- Alternatively, wrap the
navigator access in extension activation code with a try/catch
Environment
- VS Code: 1.113.0
- Extension: puppet-vscode 1.5.5
- OS: Debian Linux (x86_64)
- Puppet: 8.25.0
- Ruby: 3.3.8
Description
The Puppet extension (v1.5.5) fails to activate on VS Code 1.113, resulting in broken syntax highlighting and all language features being unavailable.
Root Cause
VS Code 1.113 ships with a newer Node.js version that exposes
navigatoras a global object via a Proxy. When extension code accessesnavigator, VS Code throws aPendingMigrationError(see https://aka.ms/vscode-extensions/navigator).Two dependencies in the extension trigger this error:
axios(including v1.9.0) — accessesnavigatoratdist/node/axios.cjslineconst _navigator = typeof navigator === 'object' && navigator || undefined;. Thetypeofcheck returns'object'(the Proxy exists), but the subsequent property access triggers the error.@microsoft/applicationinsights-web-basic— accessesnavigatorviagetNavigator()for telemetryNote: Updating axios to 1.9.0 does NOT fix the issue — axios 1.9.0 still accesses
navigatorthe same way.Error Logs
From
remoteexthost.log:Impact
.ppand.eppfilesWorkaround
Manually patch the two files in the extension's
node_modules:1. Patch axios (
node_modules/axios/dist/node/axios.cjs):2. Patch applicationinsights-web-basic (
node_modules/@microsoft/applicationinsights-web-basic/dist/es5/applicationinsights-web-basic.js):function getNavigator() { - !_globalLazyTestHooks && _initTestHooks(); - (!_cachedNavigator || _globalLazyTestHooks.lzy) && (_cachedNavigator = createCachedValue(safe((getInst), ["navigator"]).v)); - return _cachedNavigator.v; + return NULL_VALUE; }Then reload VS Code (
Ctrl+Shift+P→ "Reload Window").Note: This workaround is local and will be overwritten if the extension updates.
Suggested Fix
axiosto a version that does not access thenavigatorglobal (or guard the access with a try/catch)@microsoft/applicationinsights-web-basic/@vscode/extension-telemetryto a version compatible with VS Code 1.113'snavigatorProxynavigatoraccess in extension activation code with a try/catchEnvironment