nuxt-ai-ready 0.7.7 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -3,26 +3,5 @@ import { useRuntimeConfig } from "nitropack/runtime";
|
|
|
3
3
|
export async function createConnector(event) {
|
|
4
4
|
const config = useRuntimeConfig(event)["nuxt-ai-ready"];
|
|
5
5
|
const bindingName = config.database.bindingName || "DB";
|
|
6
|
-
|
|
7
|
-
try {
|
|
8
|
-
const context = event?.context || useEvent?.()?.context;
|
|
9
|
-
cloudflareEnv = context?.cloudflare?.env;
|
|
10
|
-
} catch {
|
|
11
|
-
cloudflareEnv = globalThis.__env__;
|
|
12
|
-
}
|
|
13
|
-
const binding = cloudflareEnv?.[bindingName];
|
|
14
|
-
if (!binding) {
|
|
15
|
-
const debug = {
|
|
16
|
-
hasEvent: !!event,
|
|
17
|
-
hasContext: !!event?.context,
|
|
18
|
-
hasCloudflare: !!event?.context?.cloudflare,
|
|
19
|
-
hasCloudflareEnv: !!event?.context?.cloudflare?.env,
|
|
20
|
-
hasGlobalEnv: !!globalThis.__env__,
|
|
21
|
-
cloudflareEnvKeys: cloudflareEnv ? Object.keys(cloudflareEnv) : [],
|
|
22
|
-
bindingName
|
|
23
|
-
};
|
|
24
|
-
console.error(`[D1 Debug] Binding '${bindingName}' not found. Context:`, JSON.stringify(debug, null, 2));
|
|
25
|
-
throw new Error(`D1 binding '${bindingName}' not found in event.context.cloudflare.env or globalThis.__env__`);
|
|
26
|
-
}
|
|
27
|
-
return adapter({ binding });
|
|
6
|
+
return adapter({ bindingName });
|
|
28
7
|
}
|
|
@@ -9,7 +9,17 @@ export default defineNitroPlugin((nitro) => {
|
|
|
9
9
|
nitro.hooks.hook("request", async (event) => {
|
|
10
10
|
if (!seeding) {
|
|
11
11
|
seeding = seedFromSitemap(event).catch((err) => {
|
|
12
|
-
if (err.message?.includes("D1 binding")) {
|
|
12
|
+
if (err.message?.includes("D1 binding") || err.message?.includes("[d1]")) {
|
|
13
|
+
const config = useRuntimeConfig()["nuxt-ai-ready"];
|
|
14
|
+
if (config.debug) {
|
|
15
|
+
const debugInfo = {
|
|
16
|
+
hasGlobalEnv: !!globalThis.__env__,
|
|
17
|
+
globalEnvKeys: globalThis.__env__ ? Object.keys(globalThis.__env__) : [],
|
|
18
|
+
hasCloudflareContext: !!event.context?.cloudflare,
|
|
19
|
+
error: err.message
|
|
20
|
+
};
|
|
21
|
+
logger.info("[sitemap-seeder] D1 binding debug:", JSON.stringify(debugInfo, null, 2));
|
|
22
|
+
}
|
|
13
23
|
logger.info("[sitemap-seeder] Skipping runtime seeding - using static pages data");
|
|
14
24
|
} else {
|
|
15
25
|
logger.error("[sitemap-seeder] Failed to seed:", err);
|