Tests with Probot API from GitHub and Smee failing to accept payload? - javascript

I'm posting some sample data to my Smee endpoint and I am also running a local instance of my ProBot app. I get a bad request in my bot logs and I see this is the Smee response:
{ Error: cannot POST / (400)
at Response.toError (/usr/local/lib/node_modules/smee-client/node_modules/superagent/lib/node/response.js:94:15)
at ResponseBase._setStatusProperties (/usr/local/lib/node_modules/smee-client/node_modules/superagent/lib/response-base.js:123:16)
at new Response (/usr/local/lib/node_modules/smee-client/node_modules/superagent/lib/node/response.js:41:8)
at Request._emitResponse (/usr/local/lib/node_modules/smee-client/node_modules/superagent/lib/node/index.js:752:20)
at IncomingMessage.parser (/usr/local/lib/node_modules/smee-client/node_modules/superagent/lib/node/index.js:916:38)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
status: 400,
text: 'Required headers missing: x-github-event, x-github-delivery',
method: 'POST',
path: '/' },
How can I get these header values to test with in my app? Not sure if it's me, but the documentation doesn't note this anywhere

I used https://www.freeformatter.com/hmac-generator.html#ad-output to throw in the payload as the body and my secret and the hash was valid!

Related

Error in mineflayer: Unsupported brand channel name

I'm trying to make a mineflayer bot but it seems to keep sending the same error. Here is the code:
const mineflayer = require('mineflayer')
const bot = mineflayer.createBot({
host: 'localhost',
port: ,
username: 'Test_Bot'
})
And here is the error:
Error: Unsupported brand channel name
at getBrandCustomChannelName (/Users/jeonghunchae/Desktop/Bots/node_modules/mineflayer/lib/plugins/game.js:22:11)
at inject (/Users/jeonghunchae/Desktop/Bots/node_modules/mineflayer/lib/plugins/game.js:67:24)
at /Users/jeonghunchae/Desktop/Bots/node_modules/mineflayer/lib/plugin_loader.js:41:7
at Array.forEach (<anonymous>)
at injectPlugins (/Users/jeonghunchae/Desktop/Bots/node_modules/mineflayer/lib/plugin_loader.js:40:16)
at EventEmitter.onInjectAllowed (/Users/jeonghunchae/Desktop/Bots/node_modules/mineflayer/lib/plugin_loader.js:12:5)
at Object.onceWrapper (node:events:627:28)
at EventEmitter.emit (node:events:513:28)
at Client.next (/Users/jeonghunchae/Desktop/Bots/node_modules/mineflayer/lib/loader.js:124:9)
at Object.onceWrapper (node:events:627:28)
jeonghunchae#2015017 Bots %
Is there any way how I can fix this error?
First I tried to make a lan server in my world and it sent this error. Then I created a private server with online-mod: false but it still sent the same error.
I had the same Problem.
After a lot of research I found that I was not sure if my minecraft Version(1.19.2) was supported by Mineflayer.
After switching to 1.19 the error Message was gone.

Error while connecting to local Redis server in Node.js

I have Redis server running on localhost at port 6379 and I'm connecting to it like that:
const redisClient = redis.createClient({
url: `redis://localhost:6379`,
legacyMode: false
});
Although when I try to connect to it, it gives the following error:
TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received undefined
at new NodeError (node:internal/errors:371:5)
at _write (node:internal/streams/writable:312:13)
at WriteStream.Writable.write (node:internal/streams/writable:334:10)
at Commander.<anonymous> (C:\Users\atsukoro\Desktop\Projekty\simpleanilist\src\index.ts:42:24)
at Commander.emit (node:events:526:28)
at Commander.emit (node:domain:475:12)
at RedisSocket.<anonymous> (C:\Users\atsukoro\Desktop\Projekty\simpleanilist\node_modules\#redis\client\dist\lib\client\index.js:347:35)
at RedisSocket.emit (node:events:526:28)
at RedisSocket.emit (node:domain:475:12)
at RedisSocket._RedisSocket_connect (C:\Users\atsukoro\Desktop\Projekty\simpleanilist\node_modules\#redis\client\dist\lib\client\socket.js:114:14) {
code: 'ERR_INVALID_ARG_TYPE'
}
I found that legacyMode false will fix that issue but that didn't work either.

Error: Invalid JSON RPC response while using INFURA

getting error:While implementing ethereum blockchain code ,
error that i am getting is :Invalid JSON RPC response while using INFURA
Attaching error log below kindly help
Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (/home/joshi/Desktop/inbox/node_modules/truffle-hdwallet-provider/node_modules/web3/lib/web3/errors.js:35:16)
at XMLHttpRequest.request.onreadystatechange (/home/joshi/Desktop/inbox/node_modules/truffle-hdwallet-provider/node_modules/web3/lib/web3/httpprovider.js:115:32)
at XMLHttpRequestEventTarget.dispatchEvent (/home/joshi/Desktop/inbox/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/home/joshi/Desktop/inbox/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpRequestError (/home/joshi/Desktop/inbox/node_modules/xhr2/lib/xhr2.js:544:12)
at ClientRequest.<anonymous> (/home/joshi/Desktop/inbox/node_modules/xhr2/lib/xhr2.js:414:24)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at TLSSocket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
If you don't post more information, such as a little piece of code is difficult to understand what is happening.
What you should try is this:
In every link to infura api remove the "/v3" part from the url.
From this:
const provider = new HDWalletProvider(mnemonic,
'https://rinkeby.infura.io/v3/project_id');
To this:
const provider = new HDWalletProvider(mnemonic,
'https://rinkeby.infura.io/project_id');
Hope this helps.
Don't use www and /v3 in infura API URI and it's required to use https in the URI. eg.
https://rinkeby.infura.io/project_id

NodeJS Express Request Entity Too Large

I've tried many solutions listed here (increasing of memory limit, adding parameterlimit, adding type as 'application/json') to fix this 'Request Entity too large' error (it also returns http code 413). But none of them seem to make this error go away.
The current size of the json can range from 200k up to 400k entities.
Here is the current configuration:
app.use( bodyParser.json({limit: "15360mb", type:'application/json'}) );
app.use(bodyParser.urlencoded({
limit: "15360mb",
extended: true,
parameterLimit:5000000,
type:'application/json'
}));
app.use(bodyParser())
Any ideas on how to increase the limit?
More information
This is the full error message if it helps:
{ Error: Request Entity Too Large
at respond (/home/nodejs/server/node_modules/elasticsearch/src/lib/transport.js:307:15)
at checkRespForFailure (/home/nodejs/server/node_modules/elasticsearch/src/lib/transport.js:266:7)
at HttpConnector.<anonymous> (/home/nodejs/server/node_modules/elasticsearch/src/lib/connectors/http.js:159:7)
at IncomingMessage.bound (/home/nodejs/server/node_modules/lodash/dist/lodash.js:729:21)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1056:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
status: 413,
displayName: 'RequestEntityTooLarge',
message: 'Request Entity Too Large',
path: '/_bulk',
query: {},
body: '<large body here>'
}
Solution
The error was indeed due to wrong configuration on elasticsearch and not nodejs. Manage to fix this by following https://github.com/elastic/elasticsearch-js/issues/241 and setting http.max_content_length: 500mb in elasticsearch.yml.
#ryanlutgen also provided a link for more information about this error here.
https://github.com/elastic/elasticsearch/issues/2902
This issue has been fixed. Thanks for all the input!
If You doesn't solve your issue, bodyParser also has a limit.
You must use
app.use(bodyParser({limit: '4MB'}))

TokenError: Code was already redeemed and TokenError: Bad Request - Passport Google OAuth 2

I have a pretty basic passport setup as you can see below. Every once in a while I get two different errors. TokenError: Code was already redeemed and TokenError: Bad Request for reasons I cannot seem to find.
I've looked around a lot (1 week) for possible solutions but am yet to find one which works.
Do you see anything wrong with the current code?
app.get('/auth/google', redirect, passport.authenticate('google', { scope: ['profile', 'email'] }));
app.get('/auth/google/callback', passport.authenticate('google', { failureRedirect: '/' }),
function(req, res) {
res.redirect('/');
}
);
Here are the two errors:
TokenError: Bad Request
at Strategy.OAuth2Strategy.parseErrorResponse (/app/node_modules/passport-oauth2/lib/strategy.js:320:12)
at Strategy.OAuth2Strategy._createOAuthError (/app/node_modules/passport-oauth2/lib/strategy.js:367:16)
at /app/node_modules/passport-oauth2/lib/strategy.js:166:45
at /app/node_modules/oauth/lib/oauth2.js:177:18
at passBackControl (/app/node_modules/oauth/lib/oauth2.js:123:9)
at IncomingMessage.<anonymous> (/app/node_modules/oauth/lib/oauth2.js:143:7)
at emitNone (events.js:85:20)
at IncomingMessage.emit (events.js:179:7)
at endReadableNT (_stream_readable.js:913:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
TokenError: Code was already redeemed.
at Strategy.OAuth2Strategy.parseErrorResponse (/app/node_modules/passport-oauth2/lib/strategy.js:320:12)
at Strategy.OAuth2Strategy._createOAuthError (/app/node_modules/passport-oauth2/lib/strategy.js:367:16)
at /app/node_modules/passport-oauth2/lib/strategy.js:166:45
at /app/node_modules/oauth/lib/oauth2.js:177:18
at passBackControl (/app/node_modules/oauth/lib/oauth2.js:123:9)
at IncomingMessage.<anonymous> (/app/node_modules/oauth/lib/oauth2.js:143:7)
at emitNone (events.js:85:20)
at IncomingMessage.emit (events.js:179:7)
at endReadableNT (_stream_readable.js:913:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)

Categories

Resources