DurableObjectStub is missing all methods

Hey, I'm having a little issue. I'm trying my hand at Durable Objects for the first time and I've got some trouble getting them to work. I have this code in my index.ts:
[...]
const episodeStorageStub = env.EPISODE_STORAGE.get(episodeStorageId);

console.log(episodeStorageStub, episodeStorageStub.countQuery)
[...]
[...]
const episodeStorageStub = env.EPISODE_STORAGE.get(episodeStorageId);

console.log(episodeStorageStub, episodeStorageStub.countQuery)
[...]
And this in my durableObject.ts:
import { DurableObject } from "cloudflare:workers";

export class EpisodeStorage extends DurableObject {
async countQuery(): Promise<Number> {
const answers = (await this.ctx.storage.get<Answer[]>("answers", {allowConcurrency: true}))||[];

return answers.length;
}
}
import { DurableObject } from "cloudflare:workers";

export class EpisodeStorage extends DurableObject {
async countQuery(): Promise<Number> {
const answers = (await this.ctx.storage.get<Answer[]>("answers", {allowConcurrency: true}))||[];

return answers.length;
}
}
Yet somehow my countQuery keeps being returned as undefined. Am I overlooking something? I'm basically following this: https://developers.cloudflare.com/durable-objects/examples/build-a-counter/
Cloudflare Docs
Build a counter · Cloudflare Durable Objects docs
This example shows how to build a counter using Durable Objects and Workers with RPC methods that can print, increment, and decrement a name provided …
3 Replies
Unkn0wnCat
Unkn0wnCatOP8mo ago
The thing I am doing differently is having the class in a different file, but i still re-export the class in the main.ts via export {EpisodeStorage} from './durableObject'; That wasn't it oh god never mind
Unkn0wnCat
Unkn0wnCatOP8mo ago
so I, being a bit of a dumbass, did manage to read my logs in the web console... but i decided to ignore the big yellow warning
No description
Unkn0wnCat
Unkn0wnCatOP8mo ago
so yeah, the Yoga GraphQL comes with an older compat date... who knew
Want results from more Discord servers?
Add your server