这是indexloc提供的服务,不要输入任何密码
Skip to content

Error when trying to deploy prebuilt project #236

@antspy

Description

@antspy

Hi,

I have a monorepo setup:

.vercel/
src/
  frontend/
    ...
    terraform/
      main.tf 

(Note how the .vercel folder is at the root of the monorepo - this is required for vercel build to work correctly).

I can build & deploy this manually just fine:

pnpm vercel build --prod --token=$VERCEL_TOKEN
pnpm vercel deploy --prebuilt --prod --token=$VERCEL_TOKEN

Now I want to do the same, deploying with terraform. Following the docs, I do:

data "vercel_prebuilt_project" "frontend_dir" {
  path = "../../../"
}

# TODO: How does this interact with the .vercel/project.json stuff?
resource "vercel_deployment" "prod_deployment" {
  project_id  = vercel_project.frontend_project.id
  files       = data.vercel_prebuilt_project.frontend_dir.output
  path_prefix = data.vercel_prebuilt_project.frontend_dir.path
  production = true
}

But this raises an error when running terraform -chdir=src/frontend/terraform apply (after having run pnpm vercel build --prod --token=$VERCEL_TOKEN already):

│ Error: Error reading prebuilt output
│ 
│   with data.vercel_prebuilt_project.frontend_dir,
│   on main.tf line 61, in data "vercel_prebuilt_project" "frontend_dir":
│   61: data "vercel_prebuilt_project" "frontend_dir" {
│ 
│ An unexpected error occurred reading files from the .vercel directory: could not read file
│ ../../../.vercel/output/functions/_not-found.rsc.func: read ../../../.vercel/output/functions/_not-found.rsc.func: is a directory

And that's correct, .vercel/output/functions/_not-found.rsc.func is indeed a directory, not sure why terraform expects it to be a file. The vercel provider version is vercel/vercel v2.3.0, and I am using next 14.2.

I couldn't find anything about this error online. Do you have an idea?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions