Closed JordanFaust closed 3 months ago
We are investigating this. Internally logged as 237244.
@JordanFaust looking at your code, it looks like you set up your mock data incorrectly:
// This is incorrect
// const ldKey = `LD-Env-${clientSideId}.flags`
// The correct way is to just use `LD-env-clientSideId` without .flags
const ldKey = `LD-Env-${clientSideId}`;
await ns.put(ldKey, JSON.stringify(flags));
See index.test.ts where we use miniflare v2 to setup mock data. I don't think this is a v2/v3 issue. We will update to v3 in time separately.
Please try this and if you still have questions and issues, please reach out to our support team.
You are right I got this working. Closing this out.
Describe the bug When ran within Miniflare V3 the KV lookup on the key fails. Not matter the content written to the miniflare KV namespace the lookup fails.
To reproduce
Setup a simple hono app using the cloudflare-server-sdk
Setup miniflare to use the worker and seed expected flags within the KV:
Expected behavior
The launchdarkly SDK should work with the local mocking of KVNamespaces within Miniflare.
Logs If applicable, add any log output related to your problem.
SDK version
Language version, developer tools
OS/platform
WorkerD/Cloudflare. See above
Additional context
I think the problem is the EdgeProvider interface defined here:
The above example forcable wraps the passed KVNamespace used within the Miniflare V3 environment. This forcful wrapping solves the problem as seen from the log output:
I don't know if this is a miss on the Miniflare V3 side or within this SDK. I don't see an override for KV that only accepts a single parameter within worker-types but several accept optional parameters beyond the key. Miniflare to my understanding maps over those types to keep the API the same.