qri-io / frontend

frontend application for our qri.cloud site
GNU General Public License v3.0
3 stars 2 forks source link

Crash on Dry Run #576

Closed chriswhong closed 2 years ago

chriswhong commented 3 years ago

Dry run this code:

# load starlark dependencies
load("http.star", "http")
load("encoding/csv.star", "csv")
load("encoding/json.star", "json")
load("re.star", "re")
load("time.star", "time")

# hit the openweathermap API to get data for Brooklyn, NYC
csvDownloadUrl = "https://api.openweathermap.org/data/2.5/weather?q=Brooklyn,ny,usa&APPID=7c350ee6493701b2c9be3e8ed9c5f857&units=imperial"

raw_json = json.decode(http.get(csvDownloadUrl).body())

# set the body
temp = raw_json['main']['temp']
humidity = raw_json['main']['humidity']

ds = dataset.latest()

# append the new data as a row
ds.body.append([[str(time.now()), temp, humidity]])

# set the dataset body
dataset.commit(ds)

Error:

2.1cdaaffc.chunk.js:2 TypeError: Cannot read properties of undefined (reading 'length')
    at main.97a6ea3c.chunk.js:1
    at la (main.97a6ea3c.chunk.js:1)
    at Va (main.97a6ea3c.chunk.js:1)
    at ra (2.1cdaaffc.chunk.js:2)
    at qs (2.1cdaaffc.chunk.js:2)
    at Du (2.1cdaaffc.chunk.js:2)
    at Su (2.1cdaaffc.chunk.js:2)
    at Ou (2.1cdaaffc.chunk.js:2)
    at vu (2.1cdaaffc.chunk.js:2)
    at 2.1cdaaffc.chunk.js:2
ss @ 2.1cdaaffc.chunk.js:2
n.callback @ 2.1cdaaffc.chunk.js:2
ho @ 2.1cdaaffc.chunk.js:2
ps @ 2.1cdaaffc.chunk.js:2
ju @ 2.1cdaaffc.chunk.js:2
t.unstable_runWithPriority @ 2.1cdaaffc.chunk.js:2
Hr @ 2.1cdaaffc.chunk.js:2
Lu @ 2.1cdaaffc.chunk.js:2
vu @ 2.1cdaaffc.chunk.js:2
(anonymous) @ 2.1cdaaffc.chunk.js:2
t.unstable_runWithPriority @ 2.1cdaaffc.chunk.js:2
Hr @ 2.1cdaaffc.chunk.js:2
Kr @ 2.1cdaaffc.chunk.js:2
qr @ 2.1cdaaffc.chunk.js:2
mu @ 2.1cdaaffc.chunk.js:2
notify @ 2.1cdaaffc.chunk.js:2
t.notifyNestedSubs @ 2.1cdaaffc.chunk.js:2
t.handleChangeWrapper @ 2.1cdaaffc.chunk.js:2
m @ 2.1cdaaffc.chunk.js:2
dispatch @ VM233:3856
(anonymous) @ main.97a6ea3c.chunk.js:1
main.97a6ea3c.chunk.js:1 error parsing websocket message: TypeError: Cannot read properties of undefined (reading 'length')
ramfox commented 2 years ago

Just did this: it's actually a crash from adding the username hashing, we didn't add a way to deal with username === undefined

I'm assuming that when we dry run we don't return a username in the dataset preview, so when our display goes to show the preview, the username field is undefined.

I'll see what can be done on the backend, but we also need to not panic if the username is undefined.

ramfox commented 2 years ago

So, after looking into the backend & frontend for this.

We should have a bigger discussion about what we want to get returned in the preview, EG if we want to show generated commit titles for example, that will take a bigger refactor in the back end.

But for this current issue, we don't need to return anything from the backend, we just have a little bit of confused behavior on the frontend when we generate a run from the events & use the results to show the commit info.

fixing this will also close #485

currently working on a branch!