Velo Secrets backend import fails

I cannot seem to import the velo secrets backend module.

I have tried these 3 below, but not at the same time.

import wixSecretsBackend from ‘wix-secrets-backend’;
import {getSecret} from ‘wix-secrets-backend’;

import { secrets } from ‘wix-secrets-backend-v2’;

All fail with the same error message of “Cannot find module ‘wix-secrets-backend’ in ‘public/pages/c8ace.js’”

Does anyone know the solution to this problem?

You can’t import backend modules to frontend code. You must write secret functions in backend and import backend function into frontend.

import { secrets } from 'wix-secrets-backend.v2';

or

import wixSecretsBackend from 'wix-secrets-backend';

This API can only be used in backend files.