Error: missing secret key. A secret key is needed to secure Payload.

default discord avatar
Taun
last month
2

Hi. I don't know why it's returning this error as I have a Payload secret key, similar to this?



dsadadafsdfg-dhsuijhdisa7-djhsjdhsj-hjdhsjddfsdf-uidskjdkadkask



PS C:\git\WhitePolaroids1> yarn dev
yarn run v1.22.19
$ ts-node server.ts
[08:29:55] INFO (payload): Starting Payload...
unhandledRejection Error: Error: missing secret key. A secret key is needed to secure Payload.
    at BasePayload.init (C:\git\WhitePolaroids1\node_modules\payload\src\payload.ts:154:13)
    at getPayload (C:\git\WhitePolaroids1\node_modules\payload\src\payload.ts:407:56)
    at initHTTP (C:\git\WhitePolaroids1\node_modules\payload\src\initHTTP.ts:25:35)
    at Payload.init (C:\git\WhitePolaroids1\node_modules\payload\src\index.ts:14:35)
    at C:\git\WhitePolaroids1\server.ts:14:17
    at step (C:\git\WhitePolaroids1\server.ts:123:23)
    at Object.next (C:\git\WhitePolaroids1\server.ts:64:20)
    at asyncGeneratorStep (C:\git\WhitePolaroids1\server.ts:13:28)
    at _next (C:\git\WhitePolaroids1\server.ts:31:17)
    at C:\git\WhitePolaroids1\server.ts:36:13


I'm using Nextjs custom-server



I think it's working now. My server.ts and .env file had different strings.

    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!

    Star

    Connect with the Payload Community on Discord

    Discord

    online

    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.