Comments (7)
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.
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.
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.
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.
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.
Great thanks I'll try the workaround when I have a chance!
from terraform-aws-next-js.
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)
- This site canβt be reached HOT 1
- Modify proxy to force a version change HOT 1
- Unable to attach policy to lambda, since the iam.tf is missing in all versions starting from 1.0.0-canary.2 HOT 1
- Error: Authentication Failed Returns Status Code 0
- What services does this library use internally to manage deployments? HOT 1
- Unable to use redirect inside getServerSideProps HOT 3
- [Bug] Error while using middleware from Next 12.2 HOT 1
- TimeoutError: Promise timed out after 300000 milliseconds HOT 1
- Question: how can I use this module if I am using Cloudflare for DNS management and WAF? HOT 2
- Dynamic Routes like [id].tsx doesn't be update in my github action
- Q: What permissinos are needed for deployment? HOT 1
- Next.js v13 support HOT 10
- One or more of the CNAMEs you provided are already associated with a different resource. HOT 1
- Cannot deploy - .next-tf/lambdas\__NEXT_PAGE_LAMBDA_0.zip: no such file or directory HOT 1
- Is there a localstack sample available? HOT 1
- Getting Error during creating resources with terraform
- Deployment not deletes old files from s3 HOT 1
- NextAuth CLIENT_FETCH_ERROR , NEXTAUTH_URL
- New deployments not possible due as AWS ACLs are disabled by default HOT 1
- Alternatives? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-aws-next-js.