I have the next function using firebase in an JavaScript app. The query works fine the first time because lastDoc isn’t defined so it gets the first 7 documents in the database, but the next time when there’s a lastDoc, the query keeps returning the same first 7 docs. The lastDoc variable is updat…
Tag: node.js
Cannot set headers after they are sent to the client error nodejs error
When I am trying to post login data in Postman I get an error Cannot set headers after they are sent to the client. Error Scr I’ve tried to put process.env.SEC_KEY in this file but it doesn’t work Answer It seems that you’re trying to send response twice: Also you’re using response imp…
Why does the sender message only appear when the recipient sends a message? (socketio) (nodejs) (reactjs)
I am developing a realtime chat in nodejs and react and socket io. In theory the chat is working, but the problem is that the sender’s message only appears on the screen when the recipient sends a message too. ex : I have browser 1 and browser 2. Every time browser 1 sends messages, these messages appea…
Saving data to Firestore from Google Cloud Function
I have a function I’ved deployed and scheduled to run every morning into my Google Cloud Functions. It says it runs successfuly and I even see some of the console logs I haven’t taken out yet, but when I look at my firestore collection the data isn’t updated. If I run this same function loca…
ReactJS frontend suddenly cannot resolve many of it’s node modules
I have been working on this application for several weeks on and off. I followed the same setup process as I have for all of my past projects, installed all modules using npm insall and initialised the package.json file. Everything was working perfectly until today when I tried running the app and got a long …
@opentelemetry/sdk-node vs @opentelemetry/sdk-tracing-node
I am trying to play with open telemetry in a Node application. I find it a bit confusing that some examples ask me to install the @opentelemetry/sdk-node (like this official guide), while some others ask me to install @opentelemetry/sdk-tracing-node (like this one, also offical guide). The examples that requi…
How to make Node.JS function that calls solidity withdraw function?
I can’t get JS properly to call my solidity function withdraw funds. I have got solidity: And it works, but I cant figure out how to properly call it in JS. So far I have this in JS: It executes but it currently does not withdraw funds. Answer With ethers.js you can do it like this: I’ll recommend…
npx create-next-app asks me if I want to use TypeScript, but won’t take no for an answer
I’m getting the following when I try to do an npx create-next-app: I’m trying to work through some training that doesn’t use TypeScript, but it won’t let me select No for an answer. I don’t understand why it asks the question. Another PC of mine doesn’t ask me about TypeScr…
Login function : Error [ERR_HTTP_HEADERS_SENT]
enter image description here I’m trying to login as a user on my website and it’s giving me this error, I can register the user and search for it in the login as many times as I want if the password and username are correct, however when there is an error in the user name or password it happens th…
Calculate the difference between two dates and give the result in hh:mm format
How could I found the time difference? Answer