postmanlabs / postmanlabs/postman-code-generators

Cannot read property 'toString' of undefined when deletting a carholder

Open
#601 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

codegen
Dominant language
JavaScript
Stars
1k
Forks
381
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
a Cannot read property 'toString' of undefined error is respone when deletting a carholder,
target Employee satisfies both unassign and zero amount,but the issue this error still exist.
How should I solve this problem?

obj = {
"employee_number": null,
"balance": "0",
"is_admin": false,
"groups": [],
"_id": "6243e305b8b32b1dcf029613",
"company_id": "612d122665d86c75a41de6e4",
"user_id": {
"address": {
"country": "US",
"line_1": "4833 RUGBY AVE",
"city": "BETHESDA",
"state": "MD",
"zip_code": "20814",
"phone": "4242969622"
},
"first_login": false,
"_id": "6243e304b8b32b837802960d",
"first_name": "Delete",
"last_name": "Der",
"email": "deteter@gamil.com",
"avatar_link": "https://api.thepennyinc.com/users/581a9c7cb98f055656962a10/avatar"
},
"gpa": {
"currency_code": "USD",
"ledger_balance": 0,
"available_balance": "0",
"credit_balance": 0,
"pending_credits": 0
},
"created_date": "2022-03-30T04:56:37.750Z"
}

Additional context
this is my demo Api progarme in python:

import re
import time
import traceback
import requests
import json
import names
import string
import random
from lxml import etree
from concurrent.futures import ThreadPoolExecutor

ProductApi = 'https://api-prod.thepennyinc.com/api/v1/'

X_PENNY_API_KEY= 'My Api Key'
company_id = 'My company_id'

headers = {
'X-PENNY-API-KEY': X_PENNY_API_KEY
}

def deleteCarHolder():

Api = ProductApi+"employees/" + obj['_id'] --> 6243e305b8b32b1dcf029613

response = requests.delete(Api, headers=headers)

print(response.text) --> {"success":false,"result":{"message":"Cannot read property 'toString' of undefined"}}

test = deleteCarHolder()
test = {"success":false,"result":{"message":"Cannot read property 'toString' of undefined"}}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report names no file, test, or entry point in postman-code-generators; start by checking whether the DELETE request is handled by this repository or by the external API URL. Reproduce the request with the supplied employee payload and determine which missing value causes the server error. Done means a confirmed repository fix or a clear routing and ownership conclusion.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.