Skip to content

Uninformative failure on http error #195

Closed

Description

@shalutiwari

Getting below error when running testapp on terminal:

library(shinytest);testApp("026-shiny-inline")
Running mytest.R Error: lexical error: invalid char in json text.
                                       ERROR: Argument object must be 
                     (right here) ------^

Activity

  1. bwbioinfo commented on May 25, 2020

    @bwbioinfo
  2. warnes commented on Aug 4, 2020

    @warnes

    I had to work around this by explicitly specifying which objects to include in the snapshot.

  3. hadley commented on Aug 7, 2020

    @hadley
    Member

    @shalutiwari where can 026-shiny-inline be found?

  4. warnes commented on Aug 7, 2020

    @warnes

    This seems to occur when the subprocess server returns an error message, in my case:

    Browse[2]> 
    debug: req <- httr::GET(url)
    Browse[2]> 
    debug: if (private$snapshotCount == 1) {
        if (dir_exists(current_dir)) {
            unlink(current_dir, recursive = TRUE)
        }
        dir.create(current_dir, recursive = TRUE)
    }
    Browse[2]> 
    debug: content <- raw_to_utf8(req$content)
    Browse[2]> 
    debug: content <- hash_snapshot_image_data(content)
    Browse[2]> content
    [1] "<html>\n\n<head>\n  <title>An error has occurred</title>\n</head>\n\n<body>\n\n<h1>An error has occurred!</h1>\n<p>in 'x[[151]]': not a base at pos 19</p>\n\n</body>\n</html>\n"
    Browse[2]> cat(content)
    <html>
    
    <head>
      <title>An error has occurred</title>
    </head>
    
    <body>
    
    <h1>An error has occurred!</h1>
    <p>in 'x[[151]]': not a base at pos 19</p>
    
    </body>
    </html>
    Browse[2]>
    

    The code needs to check for a returned error code instead of assuming the results are proper JSON.

  5. warnes commented on Aug 7, 2020

    @warnes

    I've added code to fix this issue to PR #324.

  6. added
    bug
    on Aug 10, 2020
  7. changed the title [-]Error: lexical error: invalid char in json text. [/-] [+]Uninformative failure on http error[/+] on Aug 12, 2020
  8. hadley commented on Aug 14, 2020

    @hadley
    Member

    I can't reproduce the error:

    library(shinytest)
    app <- ShinyDriver$new("../shiny-examples/026-shiny-inline/index.Rmd")
    str(app$getAllValues())

    But I'm almost certain it's the same root cause as #191 or #192, which I'm about to fix momentarily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ShinyDriver 🏎️bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions