Error: You attached a public key but this route may only be accessed with a secret key

The solution to the issue with Plunk in Next JS app routing setup is to use the secret key on the server-side and define the key in the environment variables for it to work. Plunk's secret key should never be present on the front-end.

This solution was generated by AI, if you think it's wrong, please report it.

brownii7842 avatar

brownii7842

10 months ago

Getting this issue when using Plunk with Next JS app routing setup.


driaug avatar

driaug

10 months ago

Open-Source ContributorTeamUpdates

This means that you are trying to use a route that you cannot access with your public key, you need to use the secret key and put it on the server-side


brownii7842 avatar

brownii7842

10 months ago

Thanks for the help will look into this.

Thanks a lot your message really help the fix was providing the secret key, in the next project just had to define the key using NEXT_PUBLIC so it would work.

NEXT_PUBLIC_PLUNK_SECRET_KEY=sk...

Using the secret key worked appreciate it! Im using this approach as it still in development, not production ready.


driaug avatar

driaug

10 months ago

Open-Source ContributorTeamUpdates

Awesome! Keep in mind that it is fine for development but running this in production is quite dangerous because people could steal your API key and extract email addresses or even send emails in your name


brownii7842 avatar

brownii7842

10 months ago

Thanks will keep this in mind.