crobertsbmw / deckofcards

An API to simulate a deck of cards
MIT License
1.34k stars 335 forks source link

Sever error 500 when listing piles #88

Closed rjquiban closed 4 years ago

rjquiban commented 4 years ago

When I make a request to list a pile, I get the error, "Unexpected token at < in JSON at position 0" as shown below:

Screen Shot 2020-08-27 at 11 07 57 PM

However, when I visit the HTTP request link in my browser and POSTMAN, the response seems to work as expected:

Screen Shot 2020-08-27 at 11 08 46 PM

I'm obtaining and storing the data the same way as my previous API calls that work, so I'm not sure if this is an error on my end or not. Thanks in advance!

crobertsbmw commented 4 years ago

Yeah, I don't think that's an error on the server end. How are you reading the response in javascript?

On Fri, Aug 28, 2020 at 1:12 AM Rian Jasmine (RJ) notifications@github.com wrote:

When I make a request to list a pile, I get the error, "Unexpected token at < in JSON at position 0" as shown below: [image: Screen Shot 2020-08-27 at 11 07 57 PM] https://user-images.githubusercontent.com/52214808/91527223-3345e080-e8ba-11ea-8cc0-c177a0fd41d2.png

However, when I visit the HTTP request link in my browser and POSTMAN, the response seems to work as expected: [image: Screen Shot 2020-08-27 at 11 08 46 PM] https://user-images.githubusercontent.com/52214808/91527355-80c24d80-e8ba-11ea-9869-a064eb85f332.png

I'm obtaining and storing the data the same way as my previous API calls that work, so I'm not sure if this is an error on my end or not. Thanks in advance!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/crobertsbmw/deckofcards/issues/88, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMQLHU3YF3T6J4WFHEGUPTSC5DDJANCNFSM4QNYRB6A .

rjquiban commented 4 years ago
Screen Shot 2020-08-28 at 11 57 22 AM

This is my code, and I make sure to call it after I have already created a pile.

crobertsbmw commented 4 years ago

I don't usually live in the javascript world, so I'm not quite sure. The error says "Unexpected token at < in JSON at position 0" at index.js line

  1. Which line is line 95?

On Fri, Aug 28, 2020 at 1:59 PM Rian Jasmine (RJ) notifications@github.com wrote:

[image: Screen Shot 2020-08-28 at 11 57 22 AM] https://user-images.githubusercontent.com/52214808/91605679-b2bcc980-e925-11ea-82e0-38dc45e0d763.png This is my code, and I make sure to call it after I have already created a pile.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/crobertsbmw/deckofcards/issues/88#issuecomment-683083616, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMQLHX227NIIO37APA63OLSC75ADANCNFSM4QNYRB6A .

rjquiban commented 4 years ago

Line 95 is the console.log(error) catch case. I'll keep exploring my code to try and find a solution. Thanks anyways for your help!