Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate sql front matter #1005

Closed
Fil opened this issue Mar 6, 2024 · 1 comment · Fixed by #1054 or #1143
Closed

Validate sql front matter #1005

Fil opened this issue Mar 6, 2024 · 1 comment · Fixed by #1054 or #1143
Labels
bug Something isn’t working

Comments

@Fil
Copy link
Contributor

Fil commented Mar 6, 2024

I got a crash when I (mis)-typed a sql definition:

---
sql:
  - presse: ./data/presse.parquet
---

because of the leading dash - before presse, the data structure wasn't as expected and resulted an uncaught error in the console
Uncaught TypeError: name.split is not a function at FileAttachment (stdlib.js:17:68)

And some [Object object] appeared in the source code. Lastly, this broke the socket so the page wouldn't update anymore in preview.

This should be caught before, by validating the structure returned by front matter.

@Fil Fil added the enhancement New feature or request label Mar 6, 2024
@mbostock mbostock added bug Something isn’t working and removed enhancement New feature or request labels Mar 7, 2024
@Fil
Copy link
Contributor Author

Fil commented Mar 8, 2024

A different case:

---
sql:
  test: []
---

results in a crash:

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (node:fs:756:18)
    at tryReadSync (node:fs:432:20)
    at readFileSync (node:fs:486:19)
    at getFileInfo (file:///Users/fil/Source/framework/src/javascript/module.ts:1:2541)
    at getFileHash (file:///Users/fil/Source/framework/src/javascript/module.ts:1:2221)
    at getResolvers (file:///Users/fil/Source/framework/src/resolvers.ts:1:2445)
    at renderPage (file:///Users/fil/Source/framework/src/render.ts:1:729)
    at Server._handleRequest (file:///Users/fil/Source/framework/src/preview.ts:1:5626) {
  errno: -21,
  code: 'EISDIR',
  syscall: 'read'
}

Fil added a commit that referenced this issue Mar 14, 2024
validate data.sql shape

closes #1005
@Fil Fil closed this as completed in #1054 Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants