![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
First, you'll need a vercel.json
file in your project:
{
"functions": {
"api/**/*.rs": {
"runtime": "vercel-rust@3.1.2"
}
}
}
A Vercel Function will be created for every file that matches api/**/*.rs
.
api/handler.rs
:
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"
Note: Cargo.toml
must exist on the same level as the .rs files.
This Builder supports installing dependencies defined in the Cargo.toml
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
graph TD
A["Lambda Invocation"] --> |"process_request(event: LambdaEvent<VercelEvent>) → ProxyRequest"| B[ProxyRequest]
B --> |"handler_fn(req: ProxyRequest) → Future<Output = Result<impl IntoResponse, ProxyError>>"| C["Runtime calls handler_fn"]
C --> |"Ok(r) => process_response(r)"| D["ProxyResponse"]
C --> |"Err(e) => process_error(e)"| E["ProxyError"]
Upon a request a LambdaEvent
containing a VercelEvent
is mapped to a ProxyRequest
which can be consumed in the handler function. The Result
of the handler function will be mapped into a ProxyResponse
or ProxyError
.
Cargo.toml
is setting up the workspaces for the endpoints.api/**/handler.rs
) export a function with the signature: pub async fn handler(_req: ProxyRequest) -> Result<impl IntoResponse, ProxyError>
. .
├── api
│ ├── endpoint_1
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── main.rs
│ └── endpoint_2
│ ├── Cargo.toml
│ └── src
│ └── main.rs
├── Cargo.lock
└── Cargo.toml
# Show `debug` statements in logs
VERCEL_BUILDER_DEBUG=true
entry
package in the workspace that imports all endpoint handler
fn (proc macro) with runtime initialization and routing logic.[https://github.com/awslabs/aws-lambda-rust-runtime/releases/tag/v0.3.0](Base Lambda Runtime Release Notes)
files: {
"files": {
"api/Cargo.lock": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/api/Cargo.lock"
},
"api/Cargo.toml": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/api/Cargo.toml"
},
"api/user.rs": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/api/user.rs"
},
".vercelignore": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/.vercelignore"
},
"package.json": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/package.json"
},
"pnpm-lock.yaml": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/pnpm-lock.yaml"
},
"vercel.json": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/vercel.json"
}
},
"entrypoint": "api/user.rs",
"workPath": "/vercel/path0",
"repoRootPath": "/vercel/path0",
"config": {
"zeroConfig": true,
"functions": {
"api/**/*.rs": {
"runtime": "ecklf-tmp-runtime-test@1.0.4"
}
},
"projectSettings": {
"createdAt": 1674047862614,
"installCommand": null,
"buildCommand": null,
"devCommand": null,
"outputDirectory": null,
"rootDirectory": null,
"framework": null,
"nodeVersion": "18.x"
},
"framework": null,
"nodeVersion": "18.x"
},
"meta": {
"skipDownload": true,
"cliVersion": "28.12.7"
}
}
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.