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.

TypeError: cb is not a function

See original GitHub issue

🐛 Bug Report

login by username and cookie

To Reproduce

Steps to reproduce the behavior.

Expected behavior

A clear and concise description of what you expected to happen.

Extension Output

login: cookie: /Users/otis.z/.vscode/extensions/shengchen.vscode-leetcode-0.16.1/node_modules/vsc-leetcode-cli/lib/plugins/leetcode.js:555
    return cb('invalid cookie?');
           ^

TypeError: cb is not a function
    at parseCookie (/Users/otis.z/.vscode/extensions/shengchen.vscode-leetcode-0.16.1/node_modules/vsc-leetcode-cli/lib/plugins/leetcode.js:555:12)
    at Plugin.plugin.cookieLogin (/Users/otis.z/.vscode/extensions/shengchen.vscode-leetcode-0.16.1/node_modules/vsc-leetcode-cli/lib/plugins/leetcode.js:578:22)
    at /Users/otis.z/.vscode/extensions/shengchen.vscode-leetcode-0.16.1/node_modules/vsc-leetcode-cli/lib/commands/user.js:119:12
    at /Users/otis.z/.vscode/extensions/shengchen.vscode-leetcode-0.16.1/node_modules/prompt/lib/prompt.js:336:32
    at /Users/otis.z/.vscode/extensions/shengchen.vscode-leetcode-0.16.1/node_modules/utile/node_modules/async/lib/async.js:154:25
    at assembler (/Users/otis.z/.vscode/extensions/shengchen.vscode-leetcode-0.16.1/node_modules/prompt/lib/prompt.js:333:9)
    at /Users/otis.z/.vscode/extensions/shengchen.vscode-leetcode-0.16.1/node_modules/prompt/lib/prompt.js:342:32
    at /Users/otis.z/.vscode/extensions/shengchen.vscode-leetcode-0.16.1/node_modules/prompt/lib/prompt.js:625:5
    at Interface.onLine (/Users/otis.z/.vscode/extensions/shengchen.vscode-leetcode-0.16.1/node_modules/read/lib/read.js:111:5)
    at Interface.emit (events.js:198:13)

Guidance: Press Ctrl+Shift+U, and toggle the channel to LeetCode.

Your Environment

  • os: MacOS 10.15
  • extension settings:
    • “leetcode.nodePath”: “/usr/local/bin/node”
    • “leetcode.endpoint”: “leetcode-cn”
    • “leetcode.defaultLanguage”: “java”
  • nodejs version: v10.16.0
  • vscode version: 1.42
  • extension version: 0.16.1

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

18reactions
BatuhanKorurcommented, Feb 29, 2020

for anyone having this problem, until it fixed, here is a workaround…

Terminal:

# Get leetcode CLI tools
npm install -g skygragon/leetcode-cli

# Create and open user.json file
cd ~/.lc/leetcode/user.json && code user.json

user.json:

// Enter login credentials to user.json
// From browser, login to leetcode, then Dev tools -> Application -> Cookies
// You would need LEETCODE_SESSION and csrftoken
{
    "login": "",       //username
    "sessionCSRF": "", //paste "csrftoken"
    "sessionId": "",   //paste "LEETCODE_SESSION"
}

Restart vscode, and you should be logged in.

0reactions
EliazTraycommented, Aug 23, 2022

image

code ~/.vscode/extensions/leetcode.vscode-leetcode-0.18.1/node_modules/vsc-leetcode-cli/lib/plugins/leetcode.js 

sessionId is cookie.LEETCODE_SESSION in devtools application panel. sessionCSRF is cookie.csrftoken in devtools application panel.

find line 541, follow above step. Restart, login success!

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: cb is not a function - javascript - Stack Overflow
1. You aren't passing any cb s to any of the three functions that require a callback as a second parameter. – CertainPerformance...
Read more >
TypeError: cb is not a function #917 - tediousjs/tedious - GitHub
Hi @Steexyz, for the 'cb' function issue, there is a change under PR #845 that has been recently merged into master which introduce...
Read more >
How I fixed a "cb.apply is not a function" error ... - Flavio Copes
I regularly use Gitbook, a little Node.js software used to generate an ebook from a set of markdown files. I use it for...
Read more >
Android : TypeError: cb.apply is not a function - YouTube
https://www.hows.tech/p/recommended.html ] Android : TypeError : cb.apply is not a function Note: The information provided in this video is as it ...
Read more >
npm ERR! cb.apply is not a function SOLVED - YouTube
How to solve npm ERR! cb.apply is not a function is shown. ... npm ERR! cb.apply is not a function SOLVED | node...
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