I have many functions that run uses the same header for api calls so I used a variable and assigned the headers at the top. However, it’s returning undefined for the accesskey and my program is crashing. So I just console logged the access key as well like process.env.ACCESS_KEY, and I’m getting t…
Tag: node.js
I’m unable to push my bot’s slash commands to an array. Why?
When I try to push my bot’s slash commands to an array which I want to use to register my commands, it doesn’t seem to get pushed, as when I console.log the array, it returns an empty array. But when I log each command individually, it logs properly. Why? Here is the code I use to push my bot̵…
Can you compress angular image assets on build?
What I want I have very big images in my assets, which slows down the site by a lot for slower networks. (you can read more about the topic on this lighthouse linked page) I would like to compress them at build time (ng build –prod). For local development, it is irrelevant (ng serve). Optimally I would …
Node JS displaying value at index instead of indices
Written this 2sums code to get efficent O(N) Time complexity algorithm for below problem unfortunately saw value at array nums got displayed in the output ,whereas the need is to get the indices to be displayed in output What change needs to be done below Your help is appreciated Regards, Carolyn Answer As @j…
Couldn’t generate jwt token with a nodejs sign-in
I’m trying to singin with existing user but it shows Cannot POST /api/signin. The same works with signup process and I did cross check the signin route but couldn’t find where exactly the issue occurs. signin code: router : router.get(‘/signin’,signin) app: app.use(‘/api’,a…
Can I rethrow a rejected await function, and catch it immediately
I’d like to catch all my exceptions in one place, but I can’t do that currently: There is an important thing to note if you like more try/catch. The following code won’t catch the error: […] Remember: a rejected Promise will propagate up in the stack unless you catch it. To catch the e…
Access from origin ‘https://example.com’ has been blocked even though I’ve allowed https://example.com/
I have an app made with React, Node.js and Socket.io I deployed Node backend to heroku , frontend to Netlify I know that CORS errors is related to server but no matter what I add, it just cant go through that error in the picture below. I also added proxy script to React’s package.json as “proxy&#…
TypeError: Cannot Read function of ‘fetch’ of undefined (discord.js)
Ok so basically its showing me an Error that property of fetch dosent exist i am using the replit database for a balance command (discord.js) Error Image Here is the command file: So how do I fix the error Thanks In advance Answer Well client.db does not exist, this is what your error message is telling you. …
Concurrency optimization job in V8
When concurrency optimization is triggered, a new optimization job will be dispatched to a child-thread to complete. How does Runtime know that the optimization job has been completed? I’ve found that in runtime function StackGuard, the optimized code will be set in JSFunction, but I don’t know ho…
JS: XHR loads files (>50MB) immediatly
I’m making a internet speedtest app with Node.js. Everything works fine expect the download test. I normally download at 8Mbits/s but when I try XHR requesting a text file / image (about 256 MByte) at /public/chunk/somefile.txt for example, it downloads it within 1 second which is impossible. Then I che…