DEV Community

Welcoming Sloth
Welcoming Sloth

Posted on • Updated on

I hate Amplify

Be warned, rant ahead.

Me rn

I hate Amplify. I've been using it for around 2 weeks, because serverless-next.js no longer works with Next v13.

Anyways, no worries, because I can just use Amplify, right?

Well, immediately after switching to it their CI/CD simply did not work. No idea why. It claimed to be enabled, but it was clearly not working. Spent some time trying to debug it and I'm not the only one. Whatever. Guess I'll just login and manually click the deploy button every time from the AWS console for the time being.

Great start

Bringing me to why I'm writing this rant of a blog post —
Today, after my latest deployment, ReadShape was down for an hour. Surely it's because I messed something up, right?

As it turns out, not really. It's simply because the Next.js runtime was no longer getting the environment variables. It only got them during build time, which is why the build didn't fail, but since I'm utilizing Next's ISG the server will still need access to them.

However, as you guessed, it didn't. Why not? No idea. Why was this working fine before? No idea.

After digging through Amplify's GitHub issues, turns out that if you want these variables to be accessible during runtime in your next.config.js you need to "forward" the variables by doing the following:

env: {
  MY_VARIABLE: process.env.MY_VARIABLE,
}
Enter fullscreen mode Exit fullscreen mode

Why wouldn't AWS simply do this themselves? Because fuck you.

Thanks for listening

Top comments (0)