Sentry doesn't like reports from crashpad


#1

I’m following this doc https://docs.sentry.io/clients/minidump/crashpad/ with the following code-

int main()
{
    crashpad::CrashpadClient client;
    base::FilePath handlerPath(
        L"C:\\crashpad\\crashpad\\out\\Release_x64\\crashpad_handler.com");
    base::FilePath tempDir(L"C:\\Temp");
    std::string sentryUrl =
        "https://sentry.io/api/12345678/minidump?sentry_key=thekey";

    if (!client.StartHandler(handlerPath, tempDir, base::FilePath(), sentryUrl,
                             std::map<std::string, std::string>(), std::vector<std::string>(), true, true)) {
        return 1;
    }

    printf("Started handler\n");
    if (!client.WaitForHandlerStart(INFINITE)) {
        return 1;
    }

    printf("Handler initialized\n");
    auto db = crashpad::CrashReportDatabase::Initialize(tempDir);
    if (db != nullptr && db->GetSettings() != nullptr) {
        db->GetSettings()->SetUploadsEnabled(true);
        printf("Enabled uploads\n");
    }

   // Code to cause a crash.

    return 0;
}

When I run this, the handler loads and generates the minidump files on crash but fails to upload it-

"CrashpadTest.exe"
Started handler
Handler initialized
Enabled uploads

[10628:11028:20180622,145935.677:ERROR http_transport_win.cc:387] HTTP status 400
[10628:11028:20180622,145935.779:ERROR http_transport_win.cc:408] {"error":"Miss
ing minidump upload"}

When I point crashpad to a local server, this is what it is posting-

POST /?guid=8d6e2c5c-f2c8-4c72-891b-0c19344b8b41 HTTP/1.1
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: multipart/form-data; boundary=---MultipartBoundary-xmvMRQ2oHQ4zFFgaIo7Rlojat8qt0r9H---
Content-Encoding: gzip
User-Agent: Crashpad/0.8.0 WinHTTP/6.1.7601.24000 Windows_NT/6.1.7601.24150 (x64)
Host: localhost:8080

23c0
// Binary data here, its the minidump file most probably.

What am I missing?


#2

I also had a 400 status error, apparently sentry is unable to process the gzipped format. By adding “–no-upload-gzip” to the list of arguments, passed to the “startHandler” method, the issue was solved.