question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

askpass-main.js TypeError: Cannot read properties of undefined (reading 'replace')

See original GitHub issue

Might already have a duplicate issue but I did not find one, so I am reporting this (again) here.

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version:
  • OS Version:
Version: 1.74.0-insider (user setup)
Commit: 1b1e2a2c5794df1f475976062c754651827634a9
Date: 2022-11-18T05:25:18.342Z
Electron: 19.1.3
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.22621
Sandboxed: Yes

Steps to Reproduce:

  1. Open a WSL2 project whose git remote url is ssh-based (not http-based)
  2. Make sure ssh-agent has no credential remembered (aka. the next ssh will require password prompt)
  3. Click the Commit button in vscode
  4. Shows an error dialog, whose git error output is:
> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file - -S
error: /home/username/.vscode-server-insiders/bin/1b1e2a2c5794df1f475976062c754651827634a9/extensions/git/dist/askpass-main.js:1
(()=>{"use strict";var e={4516:(e,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IPCClient=void 0;const t=r(8605);s.IPCClient=class{constructor(e){this.handlerName=e;const s=process.env.VSCODE_GIT_IPC_HANDLE;if(!s)throw new Error("Missing VSCODE_GIT_IPC_HANDLE");this.ipcHandlePath=s}call(e){const s={socketPath:this.ipcHandlePath,path:`/${this.handlerName}`,method:"POST"};return new Promise(((r,n)=>{const o=t.request(s,(e=>{if(200!==e.statusCode)return n(new Error(`Bad status code: ${e.statusCode}`));const s=[];e.on("data",(e=>s.push(e))),e.on("end",(()=>r(JSON.parse(Buffer.concat(s).toString("utf8")))))}));o.on("error",(e=>n(e))),o.write(JSON.stringify(e)),o.end()}))}}},5747:e=>{e.exports=require("fs")},8605:e=>{e.exports=require("http")}},s={};function r(t){var n=s[t];if(void 0!==n)return n.exports;var o=s[t]={exports:{}};return e[t](o,o.exports,r),o.exports}var t={};(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0});const s=r(5747),n=r(4516);function o(e){console.error("Missing or invalid credentials."),console.error(e),process.exit(1)}!function(e){if(!process.env.VSCODE_GIT_ASKPASS_PIPE)return o("Missing pipe");if(!process.env.VSCODE_GIT_ASKPASS_TYPE)return o("Missing type");if("https"!==process.env.VSCODE_GIT_ASKPASS_TYPE&&"ssh"!==process.env.VSCODE_GIT_ASKPASS_TYPE)return o(`Invalid type: ${process.env.VSCODE_GIT_ASKPASS_TYPE}`);if("fetch"===process.env.VSCODE_GIT_COMMAND&&process.env.VSCODE_GIT_FETCH_SILENT)return o("Skip silent fetch commands");const r=process.env.VSCODE_GIT_ASKPASS_PIPE,t=process.env.VSCODE_GIT_ASKPASS_TYPE,i="https"===t?e[2]:e[3];let c,a,p;"https"===t&&(c=e[4].replace(/^["']+|["':]+$/g,"")),"ssh"===t&&(/passphrase/i.test(i)?a=e[6].replace(/^["']+|["':]+$/g,""):(c=e[6].replace(/^["']+|["':]+$/g,""),p=e[15])),new n.IPCClient("askpass").call({askpassType:t,request:i,host:c,file:a,fingerprint:p}).then((e=>{s.writeFileSync(r,e+"\n"),setTimeout((()=>process.exit(0)),0)})).catch((e=>o(e)))}(process.argv)})();var n=exports;for(var o in t)n[o]=t[o];t.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

TypeError: Cannot read properties of undefined (reading 'replace')
    at /home/username/.vscode-server-insiders/bin/1b1e2a2c5794df1f475976062c754651827634a9/extensions/git/dist/askpass-main.js:1:1709
    at /home/username/.vscode-server-insiders/bin/1b1e2a2c5794df1f475976062c754651827634a9/extensions/git/dist/askpass-main.js:1:1966
    at /home/username/.vscode-server-insiders/bin/1b1e2a2c5794df1f475976062c754651827634a9/extensions/git/dist/askpass-main.js:1:1982
    at Object.<anonymous> (/home/username/.vscode-server-insiders/bin/1b1e2a2c5794df1f475976062c754651827634a9/extensions/git/dist/askpass-main.js:1:2088)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module
fatal: failed to write commit object

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jerryc05commented, Nov 22, 2022

FYI I am signing my commit using my ssh key, not GPG key

0reactions
alexminzacommented, Dec 15, 2022

Version: 1.74.1 (Universal)

2022-12-15 11:15:59.938 [info] > git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file - -S [121ms]
2022-12-15 11:15:59.938 [info] error: /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js:1
(()=>{"use strict";var e={4516:(e,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IPCClient=void 0;const t=r(8605);s.IPCClient=class{constructor(e){this.b=e;const s=process.env.VSCODE_GIT_IPC_HANDLE;if(!s)throw new Error("Missing VSCODE_GIT_IPC_HANDLE");this.a=s}call(e){const s={socketPath:this.a,path:`/${this.b}`,method:"POST"};return new Promise(((r,n)=>{const o=t.request(s,(e=>{if(200!==e.statusCode)return n(new Error(`Bad status code: ${e.statusCode}`));const s=[];e.on("data",(e=>s.push(e))),e.on("end",(()=>r(JSON.parse(Buffer.concat(s).toString("utf8")))))}));o.on("error",(e=>n(e))),o.write(JSON.stringify(e)),o.end()}))}}},5747:e=>{e.exports=require("fs")},8605:e=>{e.exports=require("http")}},s={};function r(t){var n=s[t];if(void 0!==n)return n.exports;var o=s[t]={exports:{}};return e[t](o,o.exports,r),o.exports}var t={};(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0});const s=r(5747),n=r(4516);function o(e){console.error("Missing or invalid credentials."),console.error(e),process.exit(1)}!function(e){if(!process.env.VSCODE_GIT_ASKPASS_PIPE)return o("Missing pipe");if(!process.env.VSCODE_GIT_ASKPASS_TYPE)return o("Missing type");if("https"!==process.env.VSCODE_GIT_ASKPASS_TYPE&&"ssh"!==process.env.VSCODE_GIT_ASKPASS_TYPE)return o(`Invalid type: ${process.env.VSCODE_GIT_ASKPASS_TYPE}`);if("fetch"===process.env.VSCODE_GIT_COMMAND&&process.env.VSCODE_GIT_FETCH_SILENT)return o("Skip silent fetch commands");const r=process.env.VSCODE_GIT_ASKPASS_PIPE,t=process.env.VSCODE_GIT_ASKPASS_TYPE,i="https"===t?e[2]:e[3];let c,p,a;"https"===t&&(c=e[4].replace(/^["']+|["':]+$/g,"")),"ssh"===t&&(/passphrase/i.test(i)?p=e[6].replace(/^["']+|["':]+$/g,""):(c=e[6].replace(/^["']+|["':]+$/g,""),a=e[15])),new n.IPCClient("askpass").call({askpassType:t,request:i,host:c,file:p,fingerprint:a}).then((e=>{s.writeFileSync(r,e+"\n"),setTimeout((()=>process.exit(0)),0)})).catch((e=>o(e)))}(process.argv)})();var n=exports;for(var o in t)n[o]=t[o];t.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

TypeError: Cannot read properties of undefined (reading 'replace')
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js:1:1665
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js:1:1922
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js:1:1938
    at Object.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js:1:2044)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1220:10)
    at Module.load (node:internal/modules/cjs/loader:1035:32)
    at Module._load (node:internal/modules/cjs/loader:876:12)
    at c._load (node:electron/js2c/asar_bundle:5:13343)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/
fatal: failed to write commit object
Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'replace' of Undefined in JS
The "Cannot read property 'replace' of undefined" error occurs when calling the `replace()` method on a variable that stores an `undefined` value.
Read more >
vscode cannot read properties of undefined (reading 'replace')
I've ran into a strange problem in my React Native app. I'm trying to check if an input value is NaN, where I...
Read more >
Uncaught TypeError: Cannot read properties of undefined ...
In your example Uncaught TypeError: Cannot read properties of undefined (reading 'replace' ) can occur only if your variables song and/or ...
Read more >
[SOLVED] Cannot Read Property 'replace' of Undefined in JS
This error occurs when you attempt to call the replace() method on a variable that has a value of undefined . const str...
Read more >
Get JS ej2.min.js Cannot read properties of undefined ...
Debugging browser can view this error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace'). Could you help ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found