Skip to content

Extension fails to activate on VS Code 1.113 - PendingMigrationError (navigator global) #922

Description

@nicodarge

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:

  1. 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.
  2. @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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions