Skip to content

Authentication #26

Open
Open
@RihanArfan

Description

@RihanArfan

When using AI bindings, wrangler requires logging in to run the AI models on Cloudflare even during local development. However, no link is shown to authenticate in the Nuxt console.

I'm not sure whether wrangler via getPlatformProxy even exposes a way to get the link to authenticate. If you can pass wrangler's console through to the Nuxt one it should suffice.

The current workaround is to use C3 to create Workers template, add the AI binding and launch it directly through Wrangler to authenticate wrangler system wide to your Cloudflare account.

Potentially blocks nuxt-hub/core#173

 ERROR  [nuxt] [request error] [unhandled] [500] Error: Not logged in.
    at requireLoggedIn (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/cfetch/internal.ts:133:9)
    at performApiFetch (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/cfetch/internal.ts:29:2)
    at fetchInternal (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/cfetch/internal.ts:69:19)
    at fetchPagedListResult (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/cfetch/index.ts:120:16)
    at getAccountChoices (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/user/choose-account.tsx:19:21)
    at getAccountId (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/user/user.ts:1130:19)
    at AIFetcher (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/ai/fetcher.ts:17:20)
    at Miniflare2.#handleLoopbackCustomService (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]/node_modules/miniflare/src/index.ts:819:21)
    at Server.#handleLoopback (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]/node_modules/miniflare/src/index.ts:878:16)
  at requireLoggedIn (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/cfetch/internal.ts:133:9)  
  at performApiFetch (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/cfetch/internal.ts:29:2)  
  at fetchInternal (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/cfetch/internal.ts:69:19)  
  at fetchPagedListResult (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/cfetch/index.ts:120:16)  
  at getAccountChoices (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/user/choose-account.tsx:19:21)  
  at getAccountId (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/user/user.ts:1130:19)  
  at AIFetcher (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/src/ai/fetcher.ts:17:20)  
  at Miniflare2.#handleLoopbackCustomService (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]/node_modules/miniflare/src/index.ts:819:21)  
  at Server.#handleLoopback (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]/node_modules/miniflare/src/index.ts:878:16)  
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)  
  at Object.handler (./server/api/ai.ts:3:1)  
  at async /workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:1962:19  
  at async Object.callAsync (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]/node_modules/unctx/dist/index.mjs:72:16)  
  at async Server.toNodeHandle (/workspaces/nuxt-hub-core/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:2249:7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions