![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
ecklf-tmp-runtime-test
Advanced tools
Rust runtime for Vercel Functions.
Community-maintained package to support using Rust inside Vercel Functions as a Runtime.
First, you'll need a vercel.json
file in your project:
{
"functions": {
"api/**/*.rs": {
"runtime": "vercel-rust@4.0.0-canary.0"
}
}
}
A Vercel Function will be created for every file that matches api/**/*.rs
.
Example:
use serde_json::json;
use vercel_runtime::{
lambda_http::{http::StatusCode, Error as LambdaError, Response},
run, IntoResponse, ProxyError, ProxyRequest,
};
#[tokio::main]
async fn main() -> Result<(), LambdaError> {
run(handler).await?;
Ok(())
}
pub async fn handler(_req: ProxyRequest) -> Result<impl IntoResponse, ProxyError> {
let response = Response::builder()
.status(StatusCode::OK)
.header("Content-Type", "application/json")
.body(
json!({
"message": "你好,世界"
})
.to_string(),
)?;
Ok(response)
}
Finally we need a Cargo.toml
file at the root of your repository.
# You can specify a library for shared logic here (optional)
# [lib]
# path = "src-rs/lib.rs"
# Each handler has to be specified as [[bin]]
[[bin]]
name = "handler"
path = "api/handler.rs"
This Builder supports installing dependencies defined in the Cargo.toml
file.
Furthermore, more system dependencies can be installed at build time with the presence of a shell build.sh
file in the same directory as the entrypoint file.
With vercel dev
and vercel-rust
, you can develop your Rust-based lambdas on your own machine.
During local development with vercel dev
, ensure rust
and cargo
are already installed and available in your PATH
, since they will not be installed automatically. The recommended way to install is with rustup.
Since this project contains both Rust and Node.js code, you need to install the relevant dependencies. If you're only working on the JavaScript side, you only need to install those dependencies (and vice-versa).
# install node dependencies
npm install
# install cargo dependencies
cargo fetch
Not quite. Cargo's workspaces feature is a great tool when working on multiple binaries and libraries in a single project. If a cargo workspace is found in the entrypoint, however, vercel-rust
will fail to build.
To get around this limitation, create build entries in your vercel.json
file for each Cargo.toml
that represents a Function within your workspace. In your .vercelignore
, you'll want to add any binary or library project folders that aren't needed for your lambdas to speed up the build process like your Cargo.toml
workspace.
It's also recommended to have a Cargo.lock
alongside your lambda Cargo.toml
files to speed up the build process. You can do this by running cargo check or a similar command within each project folder that contains a lambda.
If you have a compelling case for workspaces to be supported by vercel-rust
which are too cumbersome with this workaround, please submit an issue! We're always looking for feedback.
Unfortunately, the AWS Lambda Runtime for Rust relies (tangentially) on proc_macro
, which won't compile on musl targets. Without musl
, all linking must be dynamic. If you have a crate that relies on system libraries like postgres
or mysql
, you can include those library files with the includeFiles
config option and set the proper environment variables, config, etc. that you need to get the library to compile.
For more information, please see this issue.
FAQs
Rust runtime for Vercel Functions.
The npm package ecklf-tmp-runtime-test receives a total of 13 weekly downloads. As such, ecklf-tmp-runtime-test popularity was classified as not popular.
We found that ecklf-tmp-runtime-test demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.