Coder Social home page Coder Social logo

Comments (10)

khuezy avatar khuezy commented on July 23, 2024 9

Version 13 removed the deprecated target: serverless (See notes: https://github.com/vercel/next.js/releases/tag/v13.0.0)
Nextjs likes to break things on every major release, so it's extremely hard for frameworks like this to keep up. Hopefully things are better moving forward though.

Unfortunately the maintainer isn't active on this project, and I'd recommend this project: https://github.com/jetbridge/sst-prisma. They are using serverless-nextjs, which its maintainer also went AWOL... but the SST team is working on implementing their own nextjs standalone deployment (see: https://github.com/jetbridge/cdk-nextjs).

That project is still WIP, but the maintainer is very active. The amplify-hosting team is working on a solution too: aws-amplify/amplify-hosting#2343.

It looks like we're going to have to wait til sometime next year to having a working system.

from terraform-aws-next-js.

khuezy avatar khuezy commented on July 23, 2024 2

Felix now works at Vercel (darn Vercel for poaching everyone... serverless-nextjs and now our beloved Felix).
https://twitter.com/ofhouse/status/1590133247823921152

If anyone is interested in another serverless framework, I'd recommend https://github.com/jetbridge/sst-prisma. One of the contributors has made great progress on the standalone nextjs component.
We are able to deploy nextjs 13 via SST. Join and ask questions on https://discord.com/channels/983865673656705025/1027265626085019769

Hopefully the Vercel guys don't see this and poach them too.

from terraform-aws-next-js.

khuezy avatar khuezy commented on July 23, 2024 2

@stamatim Hey, target: serverless has been removed in NextJS 13+. The target properly is set under the hood of this library to generate the build.
I'd recommend moving away from this terraform library and into sst: https://discord.gg/sst (as this is no longer being maintained).
There is a new initiative called open-next that aims to standardize nextjs deployments across various cloud providers.

eg:

1. create a new Next.js app npx create-next-app@latest
2. go into the Next.js app and install npm install --save-dev sst@rc
3. add an sst.config.js
import { NextjsSite } from "sst/constructs"

export default {
  config: () => ({
    name: "my-app",
    region: "us-east-1",
  }),
  stacks: async (app) => {
    app.stack(function Web(ctx) {
      new NextjsSite(ctx.stack, "MySite")
    });
  },
}

4. run npx sst deploy

from terraform-aws-next-js.

khuezy avatar khuezy commented on July 23, 2024 1

@R-Bower https://discord.gg/sst
Nextjs channel

from terraform-aws-next-js.

R-Bower avatar R-Bower commented on July 23, 2024

@khuezy I've tried to replicate the nextjs deployment but am seeing some build errors. Tried to join the discord but the link you provided takes me to a broken server.

from terraform-aws-next-js.

stamatim avatar stamatim commented on July 23, 2024

Having this issue as well. Particularly the:

Error: The "target" property is no longer supported in next.config.js.

I do not have any "target" property in my nextjs.config.js file...

/**
 * @type {import('next').NextConfig}
 */
module.exports = {
  output: 'standalone',
  images: {
    domains: [
      'images.unsplash.com',
    ],
  },
  async headers() {
    return [
      {
        source: '/api/:path*',
        headers: [
          { key: 'Access-Control-Allow-Credentials', value: 'true' },
          { key: 'Access-Control-Allow-Origin', value: '*' },
          { key: 'Access-Control-Allow-Methods', value: 'GET,OPTIONS,PATCH,DELETE,POST,PUT' },
          {
            key: 'Access-Control-Allow-Headers',
            value:
              'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version',
          },
        ],
      },
    ];
  },
};

from terraform-aws-next-js.

ajollie avatar ajollie commented on July 23, 2024

@R-Bower hey just wanted to check did you manage to find any solution ? Thanks

from terraform-aws-next-js.

R-Bower avatar R-Bower commented on July 23, 2024

@R-Bower hey just wanted to check did you manage to find any solution ? Thanks

I went with @khuezy's recommendation and that's been working well for me.

from terraform-aws-next-js.

ajollie avatar ajollie commented on July 23, 2024

@R-Bower ok great. Thanks

from terraform-aws-next-js.

emyriounis avatar emyriounis commented on July 23, 2024

Hi everyone. With my team, we created a terraform module to deploy next.js apps on AWS.
(we support next.js v13, soon v14 too)

Feel free to try it

from terraform-aws-next-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.