Cannot read property 'provider' of undefined

I was getting this error from code that wasn’t running and wasn’t even showing logs.

The solution to my particular problem was to

import wixData from "wix-data";

The solution came from the Wix Velo team, because apparently

import {get, insert, update} from "wix-data";

was causing it.
I don’t know when this works and when it doesn’t. If you know the answer to this please comment below.

Else, I just wanted to post this so the next person hopefully finds the answer.

See the API documentation for the proper way to import wix-data.