SyntaxError: The requested module '@ai-sdk/provider-utils' does not provide an export named 'validatorSymbol'
chanmathew opened this issue · comments
Description
When using the latest ai package 3.2.37
in my Sveltekit project, I get this error when building for production.
Also running @ai-sdk/svelte 0.0.17 and @ai-sdk/openai 0.0.24.
node:internal/event_target:1094
process.nextTick(() => { throw err; });
^
file:///Users/mathew/Dev/talewind-app/.svelte-kit/output/server/chunks/index2.js:2
import { safeParseJSON, getErrorMessage, isAbortError, convertBase64ToUint8Array, validatorSymbol } from "@ai-sdk/provider-utils";
^^^^^^^^^^^^^^^
SyntaxError: The requested module '@ai-sdk/provider-utils' does not provide an export named 'validatorSymbol'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async analyse (file:///Users/mathew/Dev/talewind-app/node_modules/@sveltejs/kit/src/core/postbuild/analyse.js:84:62)
at async MessagePort.<anonymous> (file:///Users/mathew/Dev/talewind-app/node_modules/@sveltejs/kit/src/utils/fork.js:22:16)
Emitted 'error' event on Worker instance at:
at [kOnErrorMessage] (node:internal/worker:326:10)
at [kOnMessage] (node:internal/worker:337:37)
at MessagePort.<anonymous> (node:internal/worker:232:57)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)
at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)
Node.js v20.15.1
error: script "build:static" exited with code 1
Code example
I'm only importing the following throughout my app:
import { createOpenAI } from '@ai-sdk/openai'
import { embed, generateObject } from 'ai'
import { useChat, type Message } from '@ai-sdk/svelte'
``
### Additional context
_No response_
Can you try update the providers to the latest versions:
@ai-sdk/openai
: 0.0.40
@ai-sdk/svelte
: 0.0.24
Still happens for me on the latest versions @lgrammel, even without @ai-sdk/svelte
. It is a SvelteKit project, though.
@didier I've just release new versions of ai
and @ai-sdk/svelte
. Can you try again with:
ai
: 3.2.38
@ai-sdk/svelte
: 0.0.25
If it does not work, please let me know which version of @ai-sdk/provider-utils
was installed.
@lgrammel Tested and its working on ai 3.2.40 and ai-sdk/svelte 0.0.26, thanks for the quick fix!
I'm getting this error too, with a different error message:
import { InvalidPromptError, AISDKError, APICallError, UnsupportedFunctionalityError, isJSONObject, isJSONArray, TypeValidationError } from "@ai-sdk/provider";
^^^^^^^^^^
SyntaxError: The requested module '@ai-sdk/provider' does not provide an export named 'AISDKError'
@xnousnow are you on the latest versions of the relevant packages?
@xnousnow can you list the exact package versions that you are using? are you using any other @ai-sdk/
packages or providers for the AI SDK?
Sure!
{
"name": "recycle",
"version": "0.0.1",
"private": true,
"scripts": {
...
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@types/eslint": "^8.56.7",
"autoprefixer": "^10.4.19",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.36.0",
"globals": "^15.0.0",
"postcss": "^8.4.38",
"prettier": "^3.3.2",
"prettier-plugin-svelte": "^3.1.2",
"prettier-plugin-tailwindcss": "^0.6.4",
"svelte": "^4.2.7",
"svelte-check": "^3.6.0",
"tailwindcss": "^3.4.4",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"typescript-eslint": "^8.0.0-alpha.20",
"unplugin-icons": "^0.19.0",
"vite": "^5.0.3"
},
"type": "module",
"dependencies": {
"@ai-sdk/anthropic": "^0.0.47", // HERE
"@ai-sdk/openai": "^0.0.28", // HERE
"@ai-sdk/svelte": "^0.0.1", // HERE
"@supabase/supabase-js": "^2.44.2",
"ai": "^3.3.17", // HERE
"dedent": "^1.5.3",
"zod": "^3.23.8"
}
}
Also, for some reason when I use the version that you provided at:
I've just release new versions of
ai
and@ai-sdk/svelte
. Can you try again with:
ai
:3.2.38
@ai-sdk/svelte
:0.0.25
If it does not work, please let me know which version of
@ai-sdk/provider-utils
was installed.
The error message changes to:
import { safeParseJSON, getErrorMessage, isAbortError, convertBase64ToUint8Array, validatorSymbol } from "@ai-sdk/provider-utils";
^^^^^^^^^^^^^^^
SyntaxError: The requested module '@ai-sdk/provider-utils' does not provide an export named 'validatorSymbol'
@xnousnow please try the latest versions:
ai@3.3.20
@ai-sdk/openai@0.0.54
@ai-sdk/anthropic@0.0.48
@ai-sdk/svelte@0.0.44
@lgrammel I'm also getting this issue. I'm using "@ai-sdk/openai": "0.0.54"
nvm, had to also update the ai
package
@AlbertMarashi please update to the latest versions of the @ai-sdk/*
packages and ai