crockpotveggies / tinderbox

Automate Tinder swiping and introductions with Eigenfaces and StanfordNLP. NOTE: support for this project has been sunset, and the original author has since directed efforts towards Bernie AI.
http://crockpotveggies.com/2015/02/09/automating-tinder-with-eigenfaces.html
Other
1.93k stars 290 forks source link

Invalid JSON error #18

Open Neologist opened 9 years ago

Neologist commented 9 years ago

I'll end up with this error, when I press the "Authorize" button:

com.fasterxml.jackson.databind.JsonMappingException: Invalid JSON. Needed [token, globals, user, versions], but found [code, error].
java.lang.Exception: Data was not wrapped in a results class. Could not parse.
    at utils.tinder.TinderApi$$anonfun$tinderPost$1.apply(TinderApi.scala:109)
    at utils.tinder.TinderApi$$anonfun$tinderPost$1.apply(TinderApi.scala:99)
    at scala.util.Success$$anonfun$map$1.apply(Try.scala:206)
    at scala.util.Try$.apply(Try.scala:161)
    at scala.util.Success.map(Try.scala:206)
    at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
    at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:67)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:82)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
    at akka.dispatch.BatchingExecutor$Batch.run(BatchingExecutor.scala:58)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:42)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:386)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

[error] play - Cannot invoke the action, eventually got an error: com.codahale.jerkson.ParsingException: Invalid JSON. Needed [status, error], but found [code, error].
[error] application -

! @6l6dmf2dl - Internal server error, for (POST) [/authenticate] ->

play.api.Application$$anon$1: Execution exception[[ParsingException: Invalid JSON. Needed [status, error], but found [code, error].]]
    at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10-2.2.2.jar:2.2.2]
    at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10-2.2.2.jar:2.2.2]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10-2.2.2.jar:2.2.2]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10-2.2.2.jar:2.2.2]
    at scala.Option.map(Option.scala:145) [scala-library-2.10.4.jar:na]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2.applyOrElse(PlayDefaultUpstreamHandler.scala:261) [play_2.10-2.2.2.jar:2.2.2]
Caused by: com.codahale.jerkson.ParsingException: Invalid JSON. Needed [status, error], but found [code, error].
    at com.codahale.jerkson.ParsingException$.apply(ParsingException.scala:9) ~[jerkson_2.10-0.6.3.jar:0.6.3]
    at com.codahale.jerkson.Parser$class.parse(Parser.scala:88) ~[jerkson_2.10-0.6.3.jar:0.6.3]
    at utils.tinder.TinderApi$$anon$1.parse(TinderApi.scala:22) ~[classes/:na]
    at com.codahale.jerkson.Parser$class.parse(Parser.scala:15) ~[jerkson_2.10-0.6.3.jar:0.6.3]
    at utils.tinder.TinderApi$$anon$1.parse(TinderApi.scala:22) ~[classes/:na]
    at utils.tinder.TinderApi$$anonfun$tinderPost$1.apply(TinderApi.scala:115) ~[classes/:na]
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Invalid JSON. Needed [status, error], but found [code, error].
    at com.codahale.jerkson.deser.CaseClassDeserializer.deserialize(CaseClassDeserializer.scala:71) ~[jerkson_2.10-0.6.3.jar:0.6.3]
    at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:3038) ~[jackson-databind-2.4.4.jar:2.4.4]
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1681) ~[jackson-databind-2.4.4.jar:2.4.4]
    at com.codahale.jerkson.Parser$class.parse(Parser.scala:93) ~[jerkson_2.10-0.6.3.jar:0.6.3]
    at utils.tinder.TinderApi$$anon$1.parse(TinderApi.scala:22) ~[classes/:na]
    at com.codahale.jerkson.Parser$class.parse(Parser.scala:15) ~[jerkson_2.10-0.6.3.jar:0.6.3]

Any ideas? I tried it on Debian 6 and Mac OS X (javac 1.7 and 1.8)

crockpotveggies commented 9 years ago

That bit about the [code, error] indicates a bigger problem likely on the Tinder side. Unfortunately, the lib isn't properly parsing the Tinder error because it doesn't fit with the standard error classes (note they usually look like [status, error]).

Can you try logging out and back in via your Android/iOS app? I'm wondering whether you were banned.

telemakhos commented 9 years ago

Same error here.. It happens randomly but after few tries you can login successfully... @crockpotveggies Is it better to run the app with sbt run or using the compiled OSX .app?

Neologist commented 9 years ago

@crockpotveggies Logging out and back in again works like a charm.

@Telemakhos What exactly do you mean with "after few tries". Do you restart the whole application several times or do you press the "Authorize" button several times?

telemakhos commented 9 years ago

@Neologist both, I restart the server several times and then try to login... I don't know how, but after 5-10 attempts it will let you log in. In the console the error is exactly the same you posted...

crockpotveggies commented 9 years ago

I'll have a chance to look at this deeper tonight, I have two primary theories as to the cause:

1) Tinder API is finicky when logging in certain users. This previously happened to me occasionally and goes away. 2) Something is happening client-side when the access token is pasted, since it is designed to extract and use the token to retrieve a Facebook ID. I'll have to trace the request if this is the case.

@Neologist the .app is actually not a compiled app, but it is an AppleScript launcher so you can put it in the dock if you want to :)

rtgoodwin commented 9 years ago

@crockpotveggies FWIW, pasting the token URL, instead of pasting in just the token text, seemed to work better for me. (It properly grabbed the ID, etc.) That said, it could have been random timing.