question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Table rows cannot have empty strings

See original GitHub issue

I ran into this the other day and it took a really long time to figure out, I’m not really sure if this is a bug or not but figured I’d bring this to your attention.

Failed to parse Dialogflow response into AppResponse

In my case I was generating a table with some data from an API endpoint like so:

const timetableCells = timetable.Trains.map((item) => {
  return {
    cells: [item.Line, item.Destination, item.Car, item.Min],
  }
})

conv.ask(new Table({
  title: `Rail Timetable for ${station}`,
  subtitle: 'Timetable as of x date',
  image: new Image({
    url: 'http://google.com/image.png',
    alt: 'Logo'
  }),
  columns: [
    {
      header: 'Line',
      align: 'LEADING'
    },
    {
      header: 'Destination',
      align: 'LEADING'
    },
    {
      header: 'Car',
      align: 'LEADING'
    },
    {
      header: 'Arrival',
      align: 'LEADING'
    },
  ],
  rows: timetableCells,
  buttons: new Button({
    title: 'Button Title',
    url: 'https://github.com/actions-on-google'
  })
}))

The returned data from timetable looks like this and the array I’m generating from map followed the correct schema for rows, as far as I could tell there should have been no issues as the generated JSON was valid.

{"Trains":[{"Car":"8","Destination":"Glenmont","DestinationCode":"B11","DestinationName":"Glenmont","Group":"1","Line":"RD","LocationCode":"B09","LocationName":"Forest Glen","Min":"9"},{"Car":"8","Destination":"Glenmont","DestinationCode":"B11","DestinationName":"Glenmont","Group":"1","Line":"RD","LocationCode":"B09","LocationName":"Forest Glen","Min":"18"},{"Car":"8","Destination":"Glenmont","DestinationCode":"B11","DestinationName":"Glenmont","Group":"1","Line":"RD","LocationCode":"B09","LocationName":"Forest Glen","Min":"36"},{"Car":"8","Destination":"Shady Gr","DestinationCode":"A15","DestinationName":"Shady Grove","Group":"2","Line":"RD","LocationCode":"B09","LocationName":"Forest Glen","Min":""}]}

timetableCells:

screen shot 2018-11-26 at 8 29 13 am

DialogFlow kept throwing a JSON parsing error and I couldn’t seem to figure out what the issue was, it was obvious to me that the data length needed to match the headers, but what wasn’t obvious was that data in row cells cannot be empty strings. Sometimes the API endpoint returns empty strings for some data that isn’t available yet. I resolved the issue with the following:

const timetableCells = timetable.Trains.map((item) => {
  return {
    cells: [item.Line || "N/A", item.Destination || "N/A", item.Car || "TBD", item.Min || "TDB"],
  }
})

I spent quite a long time debugging this, and I think this would be a good addition to the documentation if it’s indeed intended and not a bug.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Flekercommented, Oct 23, 2020

I can no longer reproduce this. A cell with an empty string will render without throwing an exception.

1reaction
Flekercommented, Dec 3, 2018

I’ve filed a bug internally about updating the documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can not select rows where column values are empty string in ...
I have a column which has varchars like " ...
Read more >
Display empty cells, null (#N/A) values, and hidden worksheet ...
Change the way that empty cells, null (#N/A) values, and hidden rows and columns are displayed in a chart. Click the chart you...
Read more >
How NULL and empty strings are treated in PostgreSQL vs ...
Oracle reads empty strings as NULLs, while PostgreSQL treats them as ... 2nd row, we don't have a NULL value, we still have...
Read more >
Resolve "HIVE_BAD_DATA: Error parsing field value for field ...
When I query data in Amazon Athena, I get an error similar to one of ... If the error message specifies a null...
Read more >
CREATE TABLE - Snowflake Documentation
In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found