I tried modifying the fullstack-app in the serverless-components repo by removing the existing ‘site’ folder, creating a next.js app in a new ‘site’ directory by running npx create-next-app site
, and adding the same serverless.yml back to the ‘site’ directory.
After making sure that next.js placed its build files in the fullstack-app/site/build directory (similar to how it was originally in the repo above) I was able run serverless deploy
successfully.
However, when I try to access the site url in cloudfront, I get a “This site can’t be reached” message, which, after some time becomes an ‘access denied’ message in the form of XML.
Does anyone know how to get serverless to play well with next.js? I cannot find any working tutorials online, and most of the discussion I have found online is a bit out of date with regard to either next.js or serverless-components.