Skip to content

[notebooks]: if the autosave api returns an error, the ui still shows that the notebook saved, when it didn't #6999

@philjb

Description

@philjb

About the bug

The Notebooks page includes an autosave feature which saves the notebook on any edit. The ui says "autosaved"

Image

The ui for an edit makes a request to PATCH /api/v2private/notebooks/0e56555f4d866000 HTTP/1.1 for example (0e56555f4d866000 is the notebook id) with the updated notebook as the patch data.

Like any request, this request can fail. If it does fail the UI doesn't indicate it, so it looks like the notebook was saved when it wasn't.

For example, notebooks are saved to the sqlite database. If sqlite is configured to be read only, the api will return a response like

{
	"code": "internal error",
	"message": "attempt to write a readonly database"
}

Steps to reproduce:
List the minimal actions needed to reproduce the behavior.

  1. Launch influxd with a rw sqlite db like (note the rwc)
./influxd --sqlite-path "file:/path/to/.influxdbv2/influxd.sqlite?mode=rwc"
  1. create a notebook and see that it is saved
  2. shutdown influxd and ...
  3. re-launch influxd with a read only sqlite db file by using this config option (note the ro)
./influxd --sqlite-path "file:/path/to/.influxdbv2/influxd.sqlite?mode=ro"
  1. navigate to notebooks page, and make an edit
  2. See that the ui doesn't reflect the error but you can see the error in the browser console network logs

Expected behavior:

Errors are shown in toaster popups

Actual behavior:
No error is shown and it looks like a notebook was saved when it wasn't.

Visual Proof:

Requested Behavior

Show a pop error similar to this one that says "Could not autosave notebook: " - the actual error will likely be "attempt to write a readonly database".

Image

About your environment

Environment info:

OSS 2.7.x

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions