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.

Diagnostic error: Database.batch() can only be called from inside of an Action, but documentation says this should be possible

See original GitHub issue

I’m getting the following error when trying to call batch on a database directly:

Diagnostic error: Database.batch() can only be called from inside of an Action. See docs for more details.

However, in the docs it says that batch can be called outside of an Action:

Call await this.batch in the Action (outside of actions, you can also call .batch() on the Database object)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
radexcommented, Dec 13, 2019

No. All database write operations (batch, create, update, delete) must be wrapped in an action. And you can make an action in two ways: explicitly using database.action() block or by marking a function using @action decorator

0reactions
igorcaldeiracommented, Jun 21, 2020

same question here. kinda confusing by the way it’s wrote! it would be cool unmark the “wontfix” and have a look 😃 edit: thanks stale bot, hehe

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog - WatermelonDB documentation - GitHub Pages
Read-only records that cannot be saved in the database, updated, or deleted and only exist for as long as you keep a reference...
Read more >
WatermelonDB - Error when performing batch insertion
When I use batch to insert new records to the table, from a component, I get the error TypeError: Cannot read property 'id'...
Read more >
Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >
Bulk API | Elasticsearch Guide [8.5] | Elastic
To update or delete a document in a data stream, you must target the backing index ... Each index and delete action within...
Read more >
Troubleshoot Dataflow errors | Google Cloud
They can also indicate conditions that prevent the normal logging path from functioning. Your pipeline might throw exceptions while processing data. Some of ......
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