xeon06
xeon06
Explore posts from servers
CDCloudflare Developers
Created by xeon06 on 2/1/2024 in #workers-help
WebAssembly.instantiate(): Wasm code generation disallowed by embedder
Hey folks, I'm trying to get a Wasm library to work in a Pages function, but I'm having the hardest time instantiating it. At first I was fetching the .wasm binary to instantiate, but someone in #pages-help told me it had to be bundled within the _worker.js script. Okay, now it's a UInt8Array directly in the _worker.js script but I still get this error. Is there more information on how the wasm binary should be bundled? Is it a specific format that will make the CF worker accept it?
15 replies
CDCloudflare Developers
Created by xeon06 on 2/1/2024 in #pages-help
Deployment failure logs
No description
2 replies
CDCloudflare Developers
Created by xeon06 on 1/31/2024 in #pages-help
CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder
Hey folks, I'm trying to run a wasm file compiled by emscripten on CF workers. It's working fine locally, but when I try it in production I get:
failed to asynchronously prepare wasm: CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder
failed to asynchronously prepare wasm: CompileError: WebAssembly.instantiate(): Wasm code generation disallowed by embedder
This page seems to indicate that WebAssembly.instantiate should work, am I missing something? https://developers.cloudflare.com/workers/runtime-apis/webassembly/
13 replies
CDCloudflare Developers
Created by xeon06 on 1/15/2024 in #pages-help
Accessing assets from pages functions
Hey folks, I'm building an app on Pages using the CloudFlare Astro adapter. I'm trying to access some of my static assets in a function, but Astro.locals.runtime.env.ASSETS seems to be undefined, both in directory or advanced mode. Does anyone know if there's any extra bits of config I need to do or?
10 replies
DTDrizzle Team
Created by xeon06 on 1/12/2024 in #help
Update with inner join?
Hey folks, is it possible to do an update with an inner join in order to have more complicated filter logic, with values coming from other tables, for our where?
14 replies
DTDrizzle Team
Created by xeon06 on 1/9/2024 in #help
Shifted properties in join
I'm getting some very strange join behavior. This query:
const foreignExchangeTransactions = await db
.select()
.from(transactions)
.innerJoin(inboxes, eq(transactions.inboxId, inboxes.id))
const foreignExchangeTransactions = await db
.select()
.from(transactions)
.innerJoin(inboxes, eq(transactions.inboxId, inboxes.id))
Returns a proper transaction, but the inboxes object is completely out of whack, missing some properties but also a lot of the properties are shifted:
inboxes: {
id: 'ayrmg4fy63',
createdAt: 'Budget',
cuid: 'CAD',
name: 'America/Toronto',
currencyCode: 1
}
inboxes: {
id: 'ayrmg4fy63',
createdAt: 'Budget',
cuid: 'CAD',
name: 'America/Toronto',
currencyCode: 1
}
It should be:
id: 1,
createdAt: '2024-01-09',
name: 'Budget',
cuid: 'ayrmg4fy63',
timezone: 'America/Toronto',
currencyCode: 'CAD'
id: 1,
createdAt: '2024-01-09',
name: 'Budget',
cuid: 'ayrmg4fy63',
timezone: 'America/Toronto',
currencyCode: 'CAD'
Tried with one other table and same result as well, weird shifted properties in the joiend table
2 replies
DTDrizzle Team
Created by xeon06 on 1/9/2024 in #help
Select fields with the same name in two different tables in a join
Is it possible to select two fields of the same name, but from a different table, as part of a join? e.g.
db
.select({
inboxCurrencyCode: inboxes.currencyCode,
cardCurrencyCode: cards.currencyCode,
})
.from(transactions)
.leftJoin(inboxes, eq(transactions.inboxId, inboxes.id))
.leftJoin(cards, eq(transactions.cardId, cards.id))
db
.select({
inboxCurrencyCode: inboxes.currencyCode,
cardCurrencyCode: cards.currencyCode,
})
.from(transactions)
.leftJoin(inboxes, eq(transactions.inboxId, inboxes.id))
.leftJoin(cards, eq(transactions.cardId, cards.id))
As-is, it only ever gives me one of two currencyCode fields, even if they are technically renamed by the partial select
2 replies
DTDrizzle Team
Created by xeon06 on 1/3/2024 in #help
String default for integer timestamps?
Hey folks, I'm using Drizzle with SQLite on CloudFlare D1. Using the following column schema:
createdAt: integer("created_at", { mode: "timestamp" }).default(sql`CURRENT_TIMESTAMP`),
createdAt: integer("created_at", { mode: "timestamp" }).default(sql`CURRENT_TIMESTAMP`),
From the D1 database viewer I am seeing that Drizzle creates values that look like this 2024-01-03 03:55:45, whereas values inserted via direct SQL are integers properly e.g. 1703894400. In addition, the string values show up as NULL in Drizzle Studio. Could I be doing something wrong or have I encountered a bug?
9 replies
CDCloudflare Developers
Created by xeon06 on 12/18/2023 in #workers-help
Email worker inside of a pages repo?
Hey folks, I'm trying to develop something that uses both pages for deployment of a frontend / backend website, but also an email worker. I want to try to keep the code in the same repo, but I realize that it will need to be separate deployments on CloudFlare, since pages doesn't support email routing. Are there existing patterns to keep both my pages and my email worker's code in the same repo while still being able to deploy everything?
5 replies