Web Dev -API 500 server error

Hi- I'm facing issue while using webdev endpoints API in another applications like angular17...etc.
when I recalled enpoints from webdev from ignition without using database connection its look like proper working with other applications and after database connections in API endpoints scripts using namedquery and runprepquery it show me error....500 server error.
and I used all headers also in script still showing error- 500 server error, any suggestion on this error how to resolved?

Look in your gateway logs to see the actual error messages.

showing this for web-dev API endpoint.

Your screenshot indicates the error is at line 82 of your script.

(Please post code as code, not screenshots. Tracebacks, too. Use the forum comment editor's "preformatted text" styling button.)

def doPost(request, session):

servletResponse = request["servletResponse"]
servletResponse.addHeader("Access-Control-Allow-Origin", "*")
servletResponse.addHeader('Content-Type','application/json;charset=utf-8')     
servletResponse.addHeader('Access-Control-Allow-Methods',	'POST, GET, OPTIONS, DELETE')
data = request['postData']

uname = request["data"]['userName']
fname = request["data"]['fName']
mname = request["data"]['mName']
lname = request["data"]['lName'] 
email = request["data"]['email'] 
phone = request["data"]['contact']
city = 	request["data"]['city']

try:
	query = " insert into test.dbo.clients (FirstName, MiddleName, LastName, UserName, Email, [PhoneNumber], City) VALUES(?,?,?,?,?,?,?)"
	
	args = [fname,mname,lname,uname,email,phone,city]
	
	data = system.db.runPrepUpdate(query , args, databaseConnection  = 'newclient' ) 


	return {'html':"New User Added"}
	
except Exception, e:
	return {'html':"failed"}

The implication of the error is that request['data'] is an array, not a dictionary. You should log that content to verify you have the structure you expect.

( You didn't quite get the "preformatted text" styling correct. You should edit your comment to fix it. )