-
Notifications
You must be signed in to change notification settings - Fork 69
Open
@chienhsiang-hung
Description
The GitHub Action for syncing LeetCode submissions is failing due to a TypeError in the code:
TypeError: response.data.data.submissionList.submissions is not iterable
at addToSubmissions (/home/runner/work/_actions/joshcai/leetcode-sync/v1.7/dist/index.js:14759:62)
at Object.sync (/home/runner/work/_actions/joshcai/leetcode-sync/v1.7/dist/index.js:14892:8)
at async main (/home/runner/work/_actions/joshcai/leetcode-sync/v1.7/dist/index.js:19591:3)
Steps to Reproduce:
- Run the sync LeetCode GitHub Action in a repository.
- Observe the job failure.
Suggested Solution:
Add a guard to check that response.data.data.submissionList.submissions is an array before iterating. Example fix:
const submissions = response.data?.data?.submissionList?.submissions ?? []; for (const submission of submissions) { // ... }
or
if (Array.isArray(response.data?.data?.submissionList?.submissions)) { for (const submission of response.data.data.submissionList.submissions) { // ... } }
Metadata
Metadata
Assignees
Labels
No labels