Coder Social home page Coder Social logo

Comments (7)

ofhouse avatar ofhouse commented on July 19, 2024 1

Sorry for the radio silence here.
Saw a similar error with Blitz.js and Prisma today and it seems that tf-next has some problems with prisma when it runs it inside the temporary directory it creates for every build.

As a workaround you can run tf-next build --skipDownload which runs tf-next in the same directory instead of creating a temporary one.
This fixed the issue for me (note that tf-next makes some changes to your next.config.js then that should not commited) but will investigate further why the build fails in the temporary directory.

from terraform-aws-next-js.

ofhouse avatar ofhouse commented on July 19, 2024 1

Just released [email protected] which should fix the issue.
Upgrading tf-next in your package.json should be enough to make it work, no update of the Terraform module required.

from terraform-aws-next-js.

ofhouse avatar ofhouse commented on July 19, 2024 1

Ok there was still a small error, which caused the types generation to take place in the wrong directory.
This was fixed in #87 and released in [email protected].
Closing this for now.

from terraform-aws-next-js.

ofhouse avatar ofhouse commented on July 19, 2024

Can you share more information about your project?

Seems more like a TypeScript error in the first place.
I tried out the official JavaScript example and the build looks fine to me.

However using the TypeScript example gives me a lot of TypeScript related errors.
Have you tried deploying it to Vercel, does it work there (Asking because we use a similar build process as Vercel under the hood)?

from terraform-aws-next-js.

jeremygottfried avatar jeremygottfried commented on July 19, 2024

Yes it's a typescript error.

Can you share more information about your project?

Seems more like a TypeScript error in the first place.
I tried out the official JavaScript example and the build looks fine to me.

However using the TypeScript example gives me a lot of TypeScript related errors.

Yeah I have deployed it to Vercel. I don't seem to have any typescript related issues there.

Have you tried deploying it to Vercel, does it work there (Asking because we use a similar build process as Vercel under the hood)?

Here's my tsconfig

{
  "compilerOptions": {
    "sourceMap": true,
    "outDir": "dist",
    "strict": true,
    "lib": [
      "esnext"
    ],
    "esModuleInterop": true,
    "target": "es5",
    "allowJs": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve"
  },
  "include": [
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}

tf-next version: 0.5.0
ts-node version: 9.1.1
typescript version: 4.1.3
prisma/cli version: 2.18.0
prisma/client version: 2.16.1
next version: 10.0.5

Here's next.config.js:

const withTM = require('next-transpile-modules')(['react-spring']); // pass the modules you would like to see transpiled
const path = require("path");

module.exports = withTM();

main.tf:

# main.tf

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.0"
    }
  }
}

# Main region where the resources should be created in
provider "aws" {
  region = "us-east-1"
}

module "tf_next" {
  source = "dealmore/next-js/aws"
}

output "cloudfront_domain_name" {
  value = module.tf_next.cloudfront_domain_name
}

from terraform-aws-next-js.

jeremygottfried avatar jeremygottfried commented on July 19, 2024

Great thanks I'll try the workaround when I have a chance!

from terraform-aws-next-js.

ofhouse avatar ofhouse commented on July 19, 2024

Okay, finally found the main issue.
Prisma uses the NOW_BUILDER environment variable to detect the build environment in Vercel builds.
https://github.com/prisma/prisma/blob/1d0045fe60dc1992173f3f5be84b24129f0d45a3/src/packages/cli/scripts/install.js#L10

Since our build environment is forked from the Vercel environment we also need to set this environment variable in order to get the workaround from Prisma correctly applied.
It could work to set the NOW_BUILDER='1' environment variable manually before running tf-next (not checked) but I prepare a general fix for this issue in #85.

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.