Search code examples
node.jsnext.jsgithub-actionsopenapihttp-status-code-405

405 on POST to /generate OpenAPI after deployment through Github Actions - NextJS


I have a project on github that is playing with OpenAI API and creating some text and images from words.

Is is working locally, but when I published to Github Pages using the Github Actions - NextJS and try to hit the api /generate, the server returns a 405.

I have no idea why is not working, but locally is all fine and I can see the env has the correct openapi key secret. Any ideas ?

This is the page with the issue: https://rafaelaazevedo.github.io/rediskets/

and this is my project: https://github.com/rafaelaazevedo/rediskets

You can see it is working locally.


Solution

  • Ok, so the reason why I am getting 405 is because Github Pages doesn't allow POST requests, just static content.

    See more here: Does `GitHub Pages` allow HTTP "Post" method?

    Will try to use netlify, heroku or https://www.oracle.com/cloud/free/ Free tier to host the website and is without restrictions