vercel-community / rust

🦀 Rust runtime for ▲ Vercel Serverless Functions
https://rust-runtime.vercel.app
MIT License
808 stars 50 forks source link

Tutorial leads to "NOT_FOUND" deployment #142

Open test3211234 opened 5 months ago

test3211234 commented 5 months ago

I'm new to Vercel, and wanted to use it in Rust. However, something in your README.md tutorial must be wrong or missing as this is what happens after following it and deploying it:

image

You also never spoke about these:

image

I notice you never spoke about a package.json too, even though it's in your examples. I copy pasted it, and it made no difference. Also, is this project dead? I don't see many updates.

Zxilly commented 4 months ago

I use rewrite to route the traffic, see https://github.com/Zxilly/OnedriveHostsGenerator/blob/master/vercel.json

dglsparsons commented 4 months ago

Hey, not a dead project at all. It's just not under active development at the moment, and is a community effort.

The Build & Development Settings are not needed for the Rust Runtime.

Could you share a link to your deployment, so I can investigate? I suspect it could be the rewrites, but I'm not sure.

Thanks 🙏

TraceLD commented 3 months ago

@test3211234 This is because by default the router uses directory structure based routing so your function is at localhost:3000/api/handler.

loopassembly commented 2 weeks ago

I had the same issue, and this configuration helped me. Thanks to @Zxilly ! localhost:3000/api/handler

    "outputDirectory": "public",
    "functions": {
      "api/**/*.rs": {
        "runtime": "vercel-rust@4.0.6"
      }
    },
    "rewrites": [
      {
        "source": "/(.*)",
        "destination": "/api/handler"
      }
    ]
  }