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](/_next/image?url=https%3A%2F%2Fcdn.discordapp.com%2Favatars%2F431627169576255499%2Fe06aec424aec2c1b99facc885bd1a2b2.webp&w=128&q=75)
brownii7842
A year ago
Getting this issue when using Plunk with Next JS app routing setup.
![driaug avatar](/_next/image?url=https%3A%2F%2Fcdn.discordapp.com%2Favatars%2F335852358598918145%2Fa9178d0fac8b29f7ceeca957c253f5cb.webp&w=128&q=75)
driaug
A year ago
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](/_next/image?url=https%3A%2F%2Fcdn.discordapp.com%2Favatars%2F431627169576255499%2Fe06aec424aec2c1b99facc885bd1a2b2.webp&w=128&q=75)
brownii7842
A year 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](/_next/image?url=https%3A%2F%2Fcdn.discordapp.com%2Favatars%2F335852358598918145%2Fa9178d0fac8b29f7ceeca957c253f5cb.webp&w=128&q=75)
driaug
A year ago
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](/_next/image?url=https%3A%2F%2Fcdn.discordapp.com%2Favatars%2F431627169576255499%2Fe06aec424aec2c1b99facc885bd1a2b2.webp&w=128&q=75)
brownii7842
A year ago
Thanks will keep this in mind.