ACRA / acralyzer

Open source backend for ACRA reports.
GNU General Public License v3.0
489 stars 90 forks source link

400 Error when sending report #33

Closed paour closed 11 years ago

paour commented 11 years ago

I've set up an instance on CloudAnt (great step-by-step instructions!), but I'm getting an error when ACRA tries to PUT the report:

04-24 17:13:09.255: INFO/ACRA(22421): Sending file 1366816379000-approved.stacktrace
04-24 17:13:09.300: DEBUG/ACRA(22421): Connect to https://frogsparks.cloudant.com/acra-mytrails/_design/acra-storage/_update/report
04-24 17:13:09.395: DEBUG/ACRA(22421): Sending request to https://frogsparks.cloudant.com/acra-mytrails/_design/acra-storage/_update/report/null
04-24 17:13:10.520: ERROR/ACRA(22421): Failed to send crash report for 1366816379000-approved.stacktrace
        org.acra.sender.e: Error while sending JSON report via Http PUT
        at org.acra.sender.HttpSender.a(SourceFile:228)
        at org.acra.y.a(SourceFile:179)
        at org.acra.y.a(SourceFile:141)
        at org.acra.y.run(SourceFile:77)
        Caused by: java.io.IOException: Host returned error code 400
        at org.acra.e.c.a(SourceFile:164)
        at org.acra.sender.HttpSender.a(SourceFile:225)
        ... 3 more

Reading other issue descriptions here it looks like the problem is that ACRA is somehow losing the report ID when it tries to post it (the URL ends in /report/null when it should be /report/id).

I'm using ACRA 4.5.0RC2 on Android 4.2.2 (CM10.1), configured with the following annotations. I've tried setting the preference for silent reports and unsetting it.

    formUri = "https://frogsparks.cloudant.com/acra-mytrails/_design/acra-storage/_update/report",
    reportType = org.acra.sender.HttpSender.Type.JSON,
    httpMethod = org.acra.sender.HttpSender.Method.PUT,
    formUriBasicAuthLogin = "*login*",
    formUriBasicAuthPassword = "*password*",

    formKey = "",
    mode = ReportingInteractionMode.DIALOG,
    resToastText = R.string.crash_toast_text,
    resNotifTickerText = R.string.crash_notif_ticker_text,
    resNotifTitle = R.string.crash_notif_title,
    resNotifText = R.string.crash_notif_text,
    resDialogTitle = R.string.crash_dialog_title,
    resDialogText = R.string.crash_dialog_text,
    resDialogCommentPrompt = R.string.crash_dialog_comment_prompt,
    resDialogOkToast = R.string.crash_dialog_ok_toast,
    includeDropBoxSystemTags = false,
    sendReportsInDevMode = false,
    logcatArguments = {"-t", "500", "-v", "tag",
            "AndroidRuntime:I",
            "ActivityManager:I",
            "MyTrails:V",
            "libEGL:V",
            "skia:V",
            "*:S"},
    customReportContent = {APP_VERSION_NAME, ANDROID_VERSION, PHONE_MODEL, BRAND,
            TOTAL_MEM_SIZE, AVAILABLE_MEM_SIZE, CUSTOM_DATA, STACK_TRACE, LOGCAT, INITIAL_CONFIGURATION,
            CRASH_CONFIGURATION, DISPLAY, USER_COMMENT, USER_EMAIL, DEVICE_FEATURES, SHARED_PREFERENCES, // the rest are for BugSense
            /*REPORT_ID, INSTALLATION_ID, */APP_VERSION_CODE, PACKAGE_NAME, DEVICE_ID, SETTINGS_SECURE, SETTINGS_SYSTEM,
            USER_CRASH_DATE/*, PRODUCT*/}
paour commented 11 years ago

Removing the customReportContent annotation fixed it. Probably worth documenting which content is mandatory for Acralyzer.

paour commented 11 years ago

This is a duplicate of #29.

tiagomota commented 11 years ago

I have the exact same problem but, the diference is that I dont have the customReportContent annotation. Any ideias what it might be?

paour commented 11 years ago

Perhaps you can start from the default configuration and gradually update it to your configuration until you identify the issue.

Or if you're hosting your own server you may be getting a helpful error message (I couldn't do that since I was using a third party server). Le 4 mai 2013 18:22, "TiagoMota" notifications@github.com a écrit :

I have the exact same problem but, the diference is that I dont have the customReportContent annotation. Any ideias what it might be?

— Reply to this email directly or view it on GitHubhttps://github.com/ACRA/acralyzer/issues/33#issuecomment-17436892 .

tiagomota commented 11 years ago

Im hosting at cloudant, and hte problem is the ID that is lost somewhere.

I have these annotations by the way:

formUri = "https://questtrip.cloudant.com/acra-questtrip_reports/_design/acra-storage/_update/report", reportType = org.acra.sender.HttpSender.Type.JSON, httpMethod = org.acra.sender.HttpSender.Method.PUT, formUriBasicAuthLogin="login", formUriBasicAuthPassword="pass", mode = ReportingInteractionMode.TOAST, resToastText = R.string.crash_toast_text, formKey = ""

Here is the logcat:

05-04 17:57:51.849: I/ACRA(7504): Sending file 1367682434000-approved.stacktrace 05-04 17:57:51.879: D/ACRA(7504): Connect to https://questtrip.cloudant.com/acra-questtrip_reports/_design/acra-storage/_update/report 05-04 17:57:51.899: D/dalvikvm(7504): GC_FOR_ALLOC freed 945K, 25% free 6920K/9140K, paused 21ms, total 22ms 05-04 17:57:51.919: D/ACRA(7504): Sending request to https://questtrip.cloudant.com/acra-questtrip_reports/_design/acra-storage/_update/report/null 05-04 17:57:52.209: E/ACRA(7504): Failed to send crash report for 1367682434000-approved.stacktrace 05-04 17:57:52.209: E/ACRA(7504): org.acra.sender.ReportSenderException: Error while sending JSON report via Http PUT 05-04 17:57:52.209: E/ACRA(7504): at org.acra.sender.HttpSender.send(HttpSender.java:228) 05-04 17:57:52.209: E/ACRA(7504): at org.acra.SendWorker.sendCrashReport(SendWorker.java:179) 05-04 17:57:52.209: E/ACRA(7504): at org.acra.SendWorker.checkAndSendReports(SendWorker.java:141) 05-04 17:57:52.209: E/ACRA(7504): at org.acra.SendWorker.run(SendWorker.java:77) 05-04 17:57:52.209: E/ACRA(7504): Caused by: java.io.IOException: Host returned error code 400 05-04 17:57:52.209: E/ACRA(7504): at org.acra.util.HttpRequest.send(HttpRequest.java:164) 05-04 17:57:52.209: E/ACRA(7504): at org.acra.sender.HttpSender.send(HttpSender.java:225) 05-04 17:57:52.209: E/ACRA(7504): ... 3 more 05-04 17:57:52.209: D/ACRA(7504): #checkAndSendReports - finish 05-04 17:57:53.510: D/ACRA(7504): Wait for Toast + worker ended. Kill Application ? true

rmielnik commented 11 years ago

I've got same problem. I would appreciate if someone could help.

My ReportsCrashes annotation:

    reportType = HttpSender.Type.JSON, 
    httpMethod = HttpSender.Method.PUT,        
    formKey = "",
    formUri = "http://xxx.yyy.zzz.vvv:aaa/acra-testdb/_design/acra-storage/_update/report",
    formUriBasicAuthLogin="login",
    formUriBasicAuthPassword="password",       
    mode = ReportingInteractionMode.TOAST,
    resToastText = R.string.app_name_activity

After connection established I receive log: Sending request to http://xxx.yyy.zzz.vvv:aaa/acra-testdb/_design/acra-storage/_update/report/null

hamen commented 10 years ago

Add REPORT_ID to fields to be sent and clean app data in Settings. Than solved for me.

pahla1 commented 8 years ago

@hamen thanks a lot. It's (clean app data) worked for me.

mhicauber commented 7 years ago

@hamen @younix70 which Settings were you talking about please ? (I know that's a long time ago)

pahla1 commented 7 years ago

I mean cleaning application storage data from Settings worked for me. :)

mhicauber commented 7 years ago

@younix70 Thank you. Yeah I guessed it after some thinking ^^. Worked for me too.

IbnB commented 7 years ago

I have the same error, but i don't know know which settings you guys talking about. Do you mean my android device system settings?

mhicauber commented 7 years ago

@IbnB app storage cleaning from application details screen on your android device.

IbnB commented 7 years ago

@mhicauber thanks, It worked-:)