[error] Prismic authentication state is invalid

Wasn't able to find anything around this error. Hope someone could help me out.

I've got a Next.js 13 instance running in Node v19.7.0.
When I tried npx @slicemachine/init in the directory, I got the following error:

Slice Machine  → Init command started
ℹ We collect telemetry data to improve user experience.
  Learn more: https://prismic.dev/slice-machine/telemetry
✔ Detected framework Next.js 11-13 and package manager npm
✔ Began core dependencies installation with npm ... (running in background)
✖ Logging in to Prismic...
  → Prismic authentication state is invalid.
UnexpectedDataError: Prismic authentication state is invalid.
    at PrismicAuthManager._readPersistedAuthState (/Users/x/.npm/_npx/b6923b01b288b666/node_modules/@slicemachine/manager/dist/auth/PrismicAuthManager.cjs:262:13)
    at async PrismicAuthManager.checkIsLoggedIn (/Users/x/.npm/_npx/b6923b01b288b666/node_modules/@slicemachine/manager/dist/auth/PrismicAuthManager.cjs:160:23)
    at async Task.task (/Users/x/.npm/_npx/b6923b01b288b666/node_modules/@slicemachine/init/dist/SliceMachineInitProcess.cjs:221:30)

I've tried Prismic Logout & Login, Reinstalling Prismic-cli, or manually installing slice-machine, it keeps throwing the same error. Has anyone run into the same problem?

Appreciate any help!!

Hi @motmotstudiostudio,

Thanks for your patience.

I reproduced the issue when I deleted the cookies attribute in the ~/.prismic file. I suggest you delete the ~/.prismic file and ran this command npx @slicemachine/init@latest

Let me know if this works for you.

Thanks,
Racheal.

1 Like