Google Auth working locally and failing after being deployed

I’m able to do Google auth completely normal on my localhost, but when I deploy to Vercel I get an error:

Create Next App 405 (Method Not Allowed)

What’s really strange is at one point it was working, but at some point doesn’t work. I’ve verified the environment variables, I’ve looked at the Google console, and everything seems fine. I’ve spent almost a full day on this trying to start from scratch etc, but have given up.

Hi @jlindqui, welcome to the Vercel Community!

Sorry that you’re facing this issue.

Usually the common debugging method is to confirm:

  • you’ve the correct env variables in the Vercel project
  • you’ve set up the verified domain correctly in the Google console

To learn more, see Setting up OAuth 2.0 - Google Cloud Platform Console Help.

If you need more help, please share your public repo or a minimal reproducible example. That will let us all work together from the same code to figure out what’s going wrong.

It all looks correct to me, though I don’t know how to know if my domain is verified.

If any of those are issues, are there no logs anywhere to point to an issue?

1 Like

I setup a credentials provider, used a username and password.

Again, this works locally, but fails in vercel with the same error . This doesn’t rely on google being set up properly so we can rule that out.

1 Like

I fixed my issue, though it was extremely frustrating.

It had to do with a pdf reading library I was using, but the error and issue was nowhere near it and the logs were not helpful. I think it was to do with using the files in a serverless environment, and breaking the route.

I’m now trying to print a pdf with puppeteer and having a similar issue, partly because the build has to be under 50mb and puppeteer brings in chrome. Do you have any examples of printing a pdf with puppeteer in vercel?

Hi @jlindqui, glad that you fixed the issue and thanks for sharing it here.

Can you also mention the pdf reading library here? So, if others come up with the same issue this thread helps them.

About the puppeteer issue, I found this Stack Overflow answer that might be helpful for your use case.

It was both pdf-parse & jsdom

I added them to next.config.mjs as:

experimental: {
serverComponentsExternalPackages: [“pdf-parse”, “jsdom”]
}

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.