skygragon / leetcode-cli

A cli tool to enjoy leetcode!
MIT License
3.65k stars 458 forks source link

Got 500 error when submitting #134

Closed jdneo closed 5 years ago

jdneo commented 5 years ago

leetcode-cli version: 2.6.0

Run leetcode submit *** get:

- Sending code to judge
[ERROR] http error [code=500]

trace:

[TRACE] initializing all plugins
[TRACE] found plugin: cache=default
[TRACE] found plugin: leetcode.cn=2018.11.25
[TRACE] found plugin: leetcode=default
[TRACE] found plugin: retry=default
[TRACE] inited plugin: leetcode
[TRACE] skipped plugin: leetcode.cn
[TRACE] inited plugin: retry
[TRACE] inited plugin: cache
[DEBUG] cache hit: problems.json
[DEBUG] cache hit: 1.two-sum.algorithms.json
[DEBUG] running leetcode.submitProblem
- Sending code to judge
[TRACE] REQUEST %s { url: 'https://leetcode.com/problems/two-sum/submit/',
  headers:
   { Cookie: <hidden>,
     'X-CSRFToken': <hidden>,
     'X-Requested-With': 'XMLHttpRequest',
     Origin: 'https://leetcode.com',
     Referer: 'https://leetcode.com/problems/two-sum/description/' },
  body:
   { judge_type: 'large',
     lang: 'java\r',
     question_id: 1,
     test_mode: false,
     typed_code: '/*\r\n * @lc app=leetcode id=1 lang=java\r\n *\r\n * [1] Two S                                                                                                                                                                                                    um\r\n *\r\n * https://leetcode.com/problems/two-sum/description/\r\n *\r\n * al                                                                                                                                                                                                    gorithms\r\n * Easy (39.28%)\r\n * Total Accepted:    1.2M\r\n * Total Submissio                                                                                                                                                                                                    ns: 3.1M\r\n * Testcase Example:  \'[2,7,11,15]\\n9\'\r\n *\r\n * Given an array                                                                                                                                                                                                     of integers, return indices of the two numbers such that they\r\n * add up to a                                                                                                                                                                                                     specific target.\r\n * \r\n * You may assume that each input would have exactly                                                                                                                                                                                                     one solution, and you may\r\n * not use the same element twice.\r\n * \r\n * Ex                                                                                                                                                                                                    ample:\r\n * \r\n * \r\n * Given nums = [2, 7, 11, 15], target = 9,\r\n * \r\n *                                                                                                                                                                                                     Because nums[0] + nums[1] = 2 + 7 = 9,\r\n * return [0, 1].\r\n * \r\n * \r\n *                                                                                                                                                                                                     \r\n * \r\n */\r\nclass Solution {\r\n    public int[] twoSum(int[] nums, int t                                                                                                                                                                                                    arget) {\r\n        return null;\r\n    }\r\n}\r\n' },
  method: 'POST',
  json: true,
  _delay: 1,
  callback: [Function] }
[TRACE] REQUEST %s make request https://leetcode.com/problems/two-sum/submit/
[TRACE] REQUEST %s onRequestResponse https://leetcode.com/problems/two-sum/submit/ 500 { date: 'Tue, 27 Nov 2018 08:04:44 GMT',
  'content-type': 'text/html; charset=utf-8',
  'transfer-encoding': 'chunked',
  connection: 'close',
  'set-cookie':
   <hidden>,
  'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
  'x-content-type-options': 'nosniff',
  'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
  server: 'cloudflare',
  'cf-ray': '480315db5fc9c383-SIN' }
[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode.com/problems/two-sum/submit/
[TRACE] REQUEST %s response end https://leetcode.com/problems/two-sum/submit/ 500 { date: 'Tue, 27 Nov 2018 08:04:44 GMT',
  'content-type': 'text/html; charset=utf-8',
  'transfer-encoding': 'chunked',
  connection: 'close',
  'set-cookie':
   <hidden>,
  'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
  'x-content-type-options': 'nosniff',
  'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
  server: 'cloudflare',
  'cf-ray': '480315db5fc9c383-SIN' }
[TRACE] REQUEST %s end event https://leetcode.com/problems/two-sum/submit/
[TRACE] REQUEST %s has body https://leetcode.com/problems/two-sum/submit/ 3605
[TRACE] REQUEST %s invalid JSON received https://leetcode.com/problems/two-sum/submit/
[TRACE] REQUEST %s emitting complete https://leetcode.com/problems/two-sum/submit/
[DEBUG] http error: 500
[ERROR] http error [code=500]
jdneo commented 5 years ago

I'm encountering this issue on Windows. Mac is fine.

skygragon commented 5 years ago

@jdneo please let me know if the fix above works.

jdneo commented 5 years ago

@skygragon Thanks for the fix. It works well. 👍

When will the new version get released?

skygragon commented 5 years ago

2.6.1 released, enjoy~