object not iterable in nextjs while trying to send messages - javascript

tries every possible alternative but cannot get rid of this error
when I am sending messages it return me the following error inside next js
how can I fix that???????

Related

Manipulating property transfer SOAPUI

I have a few test steps set up in SOAPUI with a property transfer step in between to transfer the sessionkey from one response to the next. The problem is, that the response is putting "" around the session key, and these need to be removed in the property transfer.
I used to have a working script that did just that:
def response = messageExchange.responseContent
response = response.replace("""","")
messageExchange.modelItem.testStep.testCase.setPropertyValue("jsonResponse",response)
However, this is no longer working and gives the following error: "Content not allowed in prolog".
Has anyone got any idea what causes this? It was working fine, but after having used SOAPUI for a few years, its now throwing this error..
Thanks!

Unexpected end of JSON input at JSON.parse(<anonymous>) While making a HTTPS GET Request

I am trying to console the data from "https://pokeapi.co/api/v2/pokemon" using HTTPS GET request but the console gives the following error:
Error I am getting while making the GET request
This is my code:
Code
I make the use of HTTPS Get request method to get the data and was expecting to get the JSON but couldn't.
res.on('data') provides a stream of data. This means that it sends parts of the request one at a time. When using the https lib you could add the responses one by one to a string and then parsing everything in res.on('end'). I would suggest though using an easier HTTP library, for instance I really like using axios. If you cannot figure out how to use res.on('data' and res.on('end' let me know and I'll type up an example for your situation.
Found the answer here:
How to get data out of a Node.js http get request

Videojs how to get ErrorCode?

I am currently trying to get the error code from a Video.js error. I know how to get the error Message but I can't figure out how to get the numeric code for the error.
According to the documentation for MediaError there is a status property which is an array (at the bottom of the page). So it could contain multiple codes.
status: Array
An optional status code that can be set by plugins to allow even more detail about the error. For example a plugin might provide a specific HTTP status code and an error message for that code. Then when the plugin gets that error this class will know how to display an error message for it. This allows a custom message to show up on the Player error overlay.
So there's no guarantee there will even be a status code, the status array could be empty. However, you can check the length of the array to see if there are entries, then loop over them looking to see if they contain the status code(s) you're concerned with.

Fetch() network error when fetching resource using a node.js API

I want to use fetch() to POST an object of arrays in javascript to a nodeJS API. I keep getting the following error 'TypeError: NetworkError when attempting to fetch resource.[Learn More] main.js:121:3' and I'm not sure how to fix it.
Here's my code for the related files (I've had to put it in pastebin since the code/text ratio was above the post requirements)
Line 121 of main.js is the fetch('localhost:3000/session', { line so I'm assuming I'm pointing the fetch() url to the incorrect place but I've tried every other route I can think of and they all produce 'NetworkError when attempting to fetch resource'.
I don't know if it's relevant but the fetch() function is within another on-click function that also creates the sessionObject object.

Overriding default PHP error messages with JavaScript

When adding more than 20 attachments to a contact form file input; PHP returns the following message:
Warning: Maximum number of allowable file uploads has been exceeded in Unknown on line 0
I can't replace this message with my own because it happens before my PHP script executes. Although If I get the returned warning and parse it with JavaScript, I can replace it with my own simpler warning message. Is there such a library that does this sort of thing with many warning and error messages that can't be changed with PHP?
You have to increase the max_file_uploads setting in php.ini, there is no way around it, if you want to use the code you have.
Or do something different, like submit the files in separate requests using AJAX.
Instead of styling the error message generated by PHP, you want to prevent it ever getting to that point. You need to implement validation before your AJAX gets submitted, so if your server only allows x file uploads at one time do:
Jquery:
if($("input:file")[0].files.length>x) {
// perform your ajax request
} else {
// show your error message
}

Categories