DeChill
DeChill
CDCloudflare Developers
Created by DeChill on 4/29/2024 in #pages-help
Installing Rust toolchain during pages build
Hi I am using a Rust module compiled to WASM in my Pages project. Since Rust isn't supported natively I have the following script to install it duringpostinstall While it works most of the time, invoking the cargo-component build step gives me an error sh: 1: cargo: not found. I guess this is because the current shell session is not configured correctly. I tried doing it manually with by invoking source $HOME/.cargo/env but the build environment does not seem to have access to the source command... /bin/sh: 1: source: not found. Now I'm looking for a way to configure the current shell to have access to the rust toolchain commands. Rust install script:
import { execSync } from 'node:child_process';

if (process.env.CF_PAGES !== '1') {
console.log('Skipping Rust setup: Not on Cloudflare Pages CI.');
process.exit(0);
}

console.log('Setting up Rust toolchain...');
execSync('curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none', {
stdio: 'inherit',
});
process.env.PATH = `${process.env.PATH}:${process.env.HOME}/.cargo/bin`;

// TODO: https://github.com/rust-lang/rustup/issues/2686 use rustup ensure to sync with rust-toolchain.toml
execSync('rustup install nightly', { stdio: 'inherit' });
console.log('Rust toolchain setup successfully!');

execSync('cargo install cargo-component', { stdio: 'inherit' });
console.log('cargo-component installed successfully!');
import { execSync } from 'node:child_process';

if (process.env.CF_PAGES !== '1') {
console.log('Skipping Rust setup: Not on Cloudflare Pages CI.');
process.exit(0);
}

console.log('Setting up Rust toolchain...');
execSync('curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none', {
stdio: 'inherit',
});
process.env.PATH = `${process.env.PATH}:${process.env.HOME}/.cargo/bin`;

// TODO: https://github.com/rust-lang/rustup/issues/2686 use rustup ensure to sync with rust-toolchain.toml
execSync('rustup install nightly', { stdio: 'inherit' });
console.log('Rust toolchain setup successfully!');

execSync('cargo install cargo-component', { stdio: 'inherit' });
console.log('cargo-component installed successfully!');
1 replies
CDCloudflare Developers
Created by DeChill on 4/11/2024 in #workers-help
Triggering Worker Functions from external Kafka Topic
Hi, I have a external Postgres DB that pushes events via Debezium to a Kafka topic. I would like to react to certain events by triggering a CF Worker. Is there any way I can trigger worker functions in response to Kafka messages or somehow connect a topic to Cloudflare Queues? Thanks in advance!
3 replies
CDCloudflare Developers
Created by DeChill on 2/26/2024 in #pages-help
Get Deployment ID during Pages build
Is there a way to get the Deployment ID of a Pages deployment during the build step as an environment variable? I know the CF_PAGES_URL contains a part of the build ID in the subdomain, but I'm looking for a way to get the whole UUID. Thanks in advance!
6 replies
CDCloudflare Developers
Created by DeChill on 6/13/2023 in #workers-help
"We could not find that Workers Service on your account" Error in Worker Dashboard
2 replies
CDCloudflare Developers
Created by DeChill on 6/10/2023 in #general-help
Cloudflare Workers Durable Objects Duration Billing Alert Units
1 replies