abhinavk99 / fortnite-bot

Telegram/Discord bot that gets information on Fortnite players
MIT License
25 stars 9 forks source link

Http 403 error #7

Closed Rosen223 closed 6 years ago

Rosen223 commented 6 years ago

here is npm test

fortnite-bot@4.0.0 test C:\Users\test\Documents\fortnite-bot mocha --reporter spec --timeout 5000

[TEMP CACHE] Resetting at Thu Jul 19 2018 12:44:20 GMT+0200 (Środkowoeuropejski czas letni)

[FIREBASE] p:0: Making a connection attempt [FIREBASE] p:0: Auth token refreshed [FIREBASE] getToken() completed. Creating connection. [FIREBASE] c:0:0: Connection created

Fortnite Data

[FIREBASE] c:0:0:0 Websocket connecting to wss://tracker-82e6a.firebaseio.com/.ws?v=5 √ should have methods to get Fortnite data √ should have methods to access the cache Username: 4,ycdoetnuid49 -- Error: HTTP Error: 403 Forbidden 1) should handle error for global with invalid username [FIREBASE] p:0: Listen called for /users/-2083043549 default [FIREBASE] c:0:0:0 Websocket connected. [FIREBASE] c:0:0: Realtime connection established. [FIREBASE] p:0: connection ready [FIREBASE] p:0: reportStats {"c":{"sdk.node.4-13-0":1}} [FIREBASE] p:0: {"r":1,"a":"s","b":{"c":{"sdk.node.4-13-0":1}}} [FIREBASE] p:0: Listen on /users/-2083043549 for default [FIREBASE] p:0: {"r":2,"a":"q","b":{"p":"/users/-2083043549","h":""}} [FIREBASE] p:0: from server: {"r":1,"b":{"s":"ok","d":""}} [FIREBASE] c:0:0: Primary connection is healthy. [FIREBASE] p:0: from server: {"r":2,"b":{"s":"permission_denied","d":"Permission denied"}} [FIREBASE] p:0: listen response {"s":"permission_denied","d":"Permission denied"} [FIREBASE] event: /users/-2083043549:cancel (node:9888) UnhandledPromiseRejectionWarning: Error: permission_denied at /users/-2083043549: Client doesn't have permission to access the desired data. at errorForServerCode (C:\Users\test\Documents\fortnite-bot\node_modules\@firebase\database\dist\index.node.cjs.js:648:17) at onComplete (C:\Users\test\Documents\fortnite-bot\node_modules\@firebase\database\dist\index.node.cjs.js:9115:36) at Object.onComplete (C:\Users\test\Documents\fortnite-bot\node_modules\@firebase\database\dist\index.node.cjs.js:12685:34) at C:\Users\test\Documents\fortnite-bot\nodemodules\@firebase\database\dist\index.node.cjs.js:11801:32 at PersistentConnection.onDataMessage (C:\Users\test\Documents\fortnite-bot\nodemodules\@firebase\database\dist\index.node.cjs.js:12056:17) at Connection.onDataMessage (C:\Users\test\Documents\fortnite-bot\nodemodules\@firebase\database\dist\index.node.cjs.js:11341:14) at Connection.onPrimaryMessageReceived (C:\Users\test\Documents\fortnite-bot\node_modules\@firebase\database\dist\index.node.cjs.js:11335:18) at WebSocketConnection.onMessage (C:\Users\test\Documents\fortnite-bot\nodemodules\@firebase\database\dist\index.node.cjs.js:11236:27) at WebSocketConnection.appendFrame (C:\Users\test\Documents\fortnite-bot\node_modules\@firebase\database\dist\index.node.cjs.js:10841:18) at WebSocketConnection.handleIncomingFrame (C:\Users\test\Documents\fortnite-bot\node_modules\@firebase\database\dist\index.node.cjs.js:10891:22) at Client.mySock.onmessage (C:\Users\test\Documents\fortnite-bot\node_modules\@firebase\database\dist\index.node.cjs.js:10788:19) at Client.dispatchEvent (C:\Users\test\Documents\fortnite-bot\node_modules\faye-websocket\lib\faye\websocket\api\event_target.js:22:30) at Client._receiveMessage (C:\Users\test\Documents\fortnite-bot\node_modules\faye-websocket\lib\faye\websocket\api.js:150:10) at Client. (C:\Users\test\Documents\fortnite-bot\node_modules\faye-websocket\lib\faye\websocket\api.js:34:49) at emitOne (events.js:121:20) at Client.emit (events.js:211:7) at Client. (C:\Users\test\Documents\fortnite-bot\node_modules\websocket-driver\lib\websocket\driver\hybi.js:454:14) at pipe (C:\Users\test\Documents\fortnite-bot\node_modules\websocket-extensions\lib\pipeline\index.js:37:40) at Pipeline._loop (C:\Users\test\Documents\fortnite-bot\node_modules\websocket-extensions\lib\pipeline\index.js:44:3) at Pipeline.processIncomingMessage (C:\Users\test\Documents\fortnite-bot\node_modules\websocket-extensions\lib\pipeline\index.js:13:8) at Extensions.processIncomingMessage (C:\Users\test\Documents\fortnite-bot\node_modules\websocket-extensions\lib\websocket_extensions.js:133:20) at Client._emitMessage (C:\Users\test\Documents\fortnite-bot\node_modules\websocket-driver\lib\websocket\driver\hybi.js:445:22) at Client._emitFrame (C:\Users\test\Documents\fortnite-bot\node_modules\websocket-driver\lib\websocket\driver\hybi.js:405:19) at Client.parse (C:\Users\test\Documents\fortnite-bot\node_modules\websocket-driver\lib\websocket\driver\hybi.js:141:18) at Client.parse (C:\Users\test\Documents\fortnite-bot\node_modules\websocket-driver\lib\websocket\driver\client.js:62:58) at IO.write (C:\Users\test\Documents\fortnite-bot\node_modules\websocket-driver\lib\websocket\streams.js:80:16) at TLSSocket.ondata (_stream_readable.js:639:20) at emitOne (events.js:116:13) at TLSSocket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at TLSSocket.Readable.push (_stream_readable.js:208:10) at TLSWrap.onread (net.js:597:20) (node:9888) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3) (node:9888) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 2) should handle error for modes with invalid username Username: 4,ycdoetnuid49 -- Error: HTTP Error: 403 Forbidden 3) should handle error for recent with invalid username Username: 4,ycdoetnuid49 -- Error: HTTP Error: 403 Forbidden 4) should handle error for rold with invalid username Username: 4,ycdoetnuid49 -- Error: HTTP Error: 403 Forbidden 5) should handle error for season with invalid username Username: 4,ycdoetnuid49 -- Error: HTTP Error: 403 Forbidden 6) should handle error for rating with invalid username Username: 4,ycdoetnuid49 -- Error: HTTP Error: 403 Forbidden 7) should handle error for kd with invalid username Username: 4,ycdoetnuid49 .y4223lt3 -- Error: HTTP Error: 403 Forbidden 8) should handle error for compare with invalid username Username: ninja -- Error: HTTP Error: 403 Forbidden 9) should get global data Username: ninja -- Error: HTTP Error: 403 Forbidden 10) should get solo season 4 data Username: ninja -- Error: HTTP Error: 403 Forbidden 11) should get recent data Username: ninja -- Error: HTTP Error: 403 Forbidden 12) should get recent data in old format Username: ninja -- Error: HTTP Error: 403 Forbidden 13) should get season 4 data Username: ninja -- Error: HTTP Error: 403 Forbidden 14) should get TRN rating data Username: ninja -- Error: HTTP Error: 403 Forbidden 15) should get K/D data Username: ninja TSM_Myth -- Error: HTTP Error: 403 Forbidden 16) should get comparing data

2 passing (13s) 16 failing

1) #Fortnite Data should handle error for global with invalid username:

  AssertionError: expected 'HTTP Error: 403 Forbidden' to equal 'User 4,ycdoetnuid49 not found.'
  + expected - actual

  -HTTP Error: 403 Forbidden
  +User 4,ycdoetnuid49 not found.

  at Context.it (test\testFortniteData.js:29:22)
  at <anonymous>
  at process._tickCallback (internal/process/next_tick.js:188:7)

2) #Fortnite Data should handle error for modes with invalid username: Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (C:\Users\test\Documents\fortnite-bot\test\testFortniteData.js)

3) #Fortnite Data should handle error for recent with invalid username:

  AssertionError: expected 'HTTP Error: 403 Forbidden' to equal 'User 4,ycdoetnuid49 not found.'
  + expected - actual

  -HTTP Error: 403 Forbidden
  +User 4,ycdoetnuid49 not found.

  at Context.it (test\testFortniteData.js:49:22)
  at <anonymous>
  at process._tickCallback (internal/process/next_tick.js:188:7)

4) #Fortnite Data should handle error for rold with invalid username:

  AssertionError: expected 'HTTP Error: 403 Forbidden' to equal 'User 4,ycdoetnuid49 not found.'
  + expected - actual

  -HTTP Error: 403 Forbidden
  +User 4,ycdoetnuid49 not found.

  at Context.it (test\testFortniteData.js:57:22)
  at <anonymous>
  at process._tickCallback (internal/process/next_tick.js:188:7)

5) #Fortnite Data should handle error for season with invalid username:

  AssertionError: expected 'HTTP Error: 403 Forbidden' to equal 'User 4,ycdoetnuid49 not found.'
  + expected - actual

  -HTTP Error: 403 Forbidden
  +User 4,ycdoetnuid49 not found.

  at Context.it (test\testFortniteData.js:65:22)
  at <anonymous>
  at process._tickCallback (internal/process/next_tick.js:188:7)

6) #Fortnite Data should handle error for rating with invalid username:

  AssertionError: expected 'HTTP Error: 403 Forbidden' to equal 'User 4,ycdoetnuid49 not found.'
  + expected - actual

  -HTTP Error: 403 Forbidden
  +User 4,ycdoetnuid49 not found.

  at Context.it (test\testFortniteData.js:73:22)
  at <anonymous>
  at process._tickCallback (internal/process/next_tick.js:188:7)

7) #Fortnite Data should handle error for kd with invalid username:

  AssertionError: expected 'HTTP Error: 403 Forbidden' to equal 'User 4,ycdoetnuid49 not found.'
  + expected - actual

  -HTTP Error: 403 Forbidden
  +User 4,ycdoetnuid49 not found.

  at Context.it (test\testFortniteData.js:81:22)
  at <anonymous>
  at process._tickCallback (internal/process/next_tick.js:188:7)

8) #Fortnite Data should handle error for compare with invalid username:

  AssertionError: expected 'HTTP Error: 403 Forbidden' to equal 'User 4,ycdoetnuid49 or .y4223lt3 not found.'
  + expected - actual

  -HTTP Error: 403 Forbidden
  +User 4,ycdoetnuid49 or .y4223lt3 not found.

  at Context.it (test\testFortniteData.js:89:22)
  at <anonymous>
  at process._tickCallback (internal/process/next_tick.js:188:7)

9) #Fortnite Data should get global data: Error: the string "HTTP Error: 403 Forbidden" was thrown, throw an Error :) at at process._tickCallback (internal/process/next_tick.js:188:7)

10) #Fortnite Data should get solo season 4 data: Error: the string "HTTP Error: 403 Forbidden" was thrown, throw an Error :) at at process._tickCallback (internal/process/next_tick.js:188:7)

11) #Fortnite Data should get recent data: Error: the string "HTTP Error: 403 Forbidden" was thrown, throw an Error :) at at process._tickCallback (internal/process/next_tick.js:188:7)

12) #Fortnite Data should get recent data in old format: Error: the string "HTTP Error: 403 Forbidden" was thrown, throw an Error :) at at process._tickCallback (internal/process/next_tick.js:188:7)

13) #Fortnite Data should get season 4 data: Error: the string "HTTP Error: 403 Forbidden" was thrown, throw an Error :) at at process._tickCallback (internal/process/next_tick.js:188:7)

14) #Fortnite Data should get TRN rating data: Error: the string "HTTP Error: 403 Forbidden" was thrown, throw an Error :) at at process._tickCallback (internal/process/next_tick.js:188:7)

15) #Fortnite Data should get K/D data: Error: the string "HTTP Error: 403 Forbidden" was thrown, throw an Error :) at at process._tickCallback (internal/process/next_tick.js:188:7)

16) #Fortnite Data should get comparing data: Error: the string "HTTP Error: 403 Forbidden" was thrown, throw an Error :) at at process._tickCallback (internal/process/next_tick.js:188:7)

abhinavk99 commented 6 years ago

Did you enter the information below in your .env? Read steps 3-9 in the Installation guide in the README.

FORTNITE_KEY=Key here
DISCORD_TOKEN=Token here
FIREBASE_KEY=Key here
FIREBASE_DOMAIN=your-project-id.firebaseapp.com
FIREBASE_URL=https://your-project-id.firebaseio.com
FIREBASE_ID=your-project-id
FIREBASE_BUCKET=your-project-id.appspot.com
Rosen223 commented 6 years ago

Yes I did everything

Rosen223 commented 6 years ago

Only /leaderboards works

abhinavk99 commented 6 years ago

Yeah, /leaderboards doesn't use any API keys so that makes sense. Do you have quotes around your values in .env? Don't add any quotes.

This is correct: FORTNITE_KEY=samplekey324343 This is NOT correct: FORTNITE_KEY="samplekey324343"

Rosen223 commented 6 years ago

I dont Have any

abhinavk99 commented 6 years ago

Can you make sure your keys are correct and that each key is in the right place (for example the discord token is with DISCORD_TOKEN and the fortnite key is with FORTNITE_KEY)?

If that's all correct, try replacing instances of process.env.TOKEN_HERE with the actual token enclosed in quotes. They are on lines 7 and 8 in src/fortniteBot.js and lines 10-14 and 19 in src/fortniteData.js.

For example on line 19 in src/fortniteData.js, replace

const client = new fortnite(process.env.FORTNITE_KEY);

with

const client = new fortnite('put your fortnite key in directly as a string.');
Rosen223 commented 6 years ago

Oh thank you that worked <3

abhinavk99 commented 6 years ago

Great!