Jonas
Jonas
Explore posts from servers
NNuxt
Created by Jonas on 11/1/2024 in #❓・help
How do I specify redis kv storage for production?
I added the following to the nitro configuration in nuxt.config.ts, but it looks like, the RAM is still used in production.
------------------------------
- Operating System: Windows_NT
- Node Version: v22.11.0
- Nuxt Version: 3.13.2
- CLI Version: 3.15.0
- Nitro Version: 2.9.7
- Package Manager: [email protected]
- Builder: -
- User Config: default
- Build Modules: -
------------------------------
------------------------------
- Operating System: Windows_NT
- Node Version: v22.11.0
- Nuxt Version: 3.13.2
- CLI Version: 3.15.0
- Nitro Version: 2.9.7
- Package Manager: [email protected]
- Builder: -
- User Config: default
- Build Modules: -
------------------------------
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
}
},
// Development
devStorage: {
db: {
driver: 'fs',
base: './data/db'
}
}
storage: {
db: {
driver: 'redis',
url: process.env.TEMPORARY_STORAGE_CONNECTION_STRING
}
},
// Development
devStorage: {
db: {
driver: 'fs',
base: './data/db'
}
}
103 replies
NNuxt
Created by Jonas on 10/14/2024 in #❓・help
ERROR Pre-transform error: [unimport] failed to find "useUserSession" imported from "#imports"
I just added srcDir: 'app/' to my nuxt.config.ts, in the hope to get a faster devserver and now I get
ERROR Pre-transform error: [unimport] failed to find "useUserSession" imported from "#imports"
ERROR Pre-transform error: [unimport] failed to find "useUserSession" imported from "#imports"
2 replies
NNuxt
Created by Jonas on 10/14/2024 in #❓・help
ERROR [worker reload] [worker init] Package import specifier "#internal/nitro/virtual/app-config"
Why do I get so many errors all of a sudden? I didn't change a single line of code. I didn't update anything. I just pnpm installed. ------------------------------ - Operating System: Windows_NT - Node Version: v18.19.0 - Nuxt Version: 3.13.2 - CLI Version: 3.14.0 - Nitro Version: 2.9.7 - Package Manager: [email protected] - Builder: - - User Config: - - Runtime Modules: - - Build Modules: - ------------------------------ [16:30:48] ERROR [worker reload] [worker init] Package import specifier "#internal/nitro/virtual/app-config" is not defined in package D:\xxx\node_modules\nitropack\package.json imported from D:\xxx\node_modules\nitropack\dist\runtime\config.mjs at __node_internal_captureLargerStackTrace (node:internal/errors:496:5) at new NodeError (node:internal/errors:405:5) at importNotDefined (node:internal/modules/esm/resolve:353:10) at packageImportsResolve (node:internal/modules/esm/resolve:803:9) at moduleResolve (node:internal/modules/esm/resolve:967:16) at defaultResolve (node:internal/modules/esm/resolve:1193:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:403:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:372:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38) at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39) at link (node:internal/modules/esm/module_job:75:36)
5 replies
NNuxt
Created by Jonas on 10/7/2024 in #❓・help
WARN [Vue warn]: Extraneous non-props attributes (data-v-14ce88ff) were passed to component
Yes, I am using 1.5.2.
Context: I am using shadcn-vue. The weird thing is, that I even disabled devtools and componentInspector in my nuxt.config.ts.
This is costing me so much time, because the server restarts all the time with this warning somehow. :/ ├── @nuxt/devtools-kit 1.5.2 ├── @nuxt/devtools 1.5.2 ├── @nuxt/devtools-kit 1.5.2 Operating System: Windows_NT Node Version: v18.19.0 Nuxt Version: 3.13.2 CLI Version: 3.14.0 Nitro Version: 2.9.7 Package Manager: [email protected] Builder: - User Config: - Runtime Modules: - Build Modules: - There is an issue on this on github, but the issue is closed, and I still have this problem.
6 replies
NNuxt
Created by Jonas on 9/28/2024 in #❓・help
Couldn't resolve component "default" at "/"
No description
17 replies
DTDrizzle Team
Created by Jonas on 8/24/2024 in #help
How do I dynamically insert multiple encrypted values?
const encryptedEmails = emails.map(email => encryptColumn(email));

const fetchedUsers = await db
.select({
id: neptun_user.id,
})
.from(neptun_user)
/* @ts-ignore */
.where(inArray(neptun_user.primary_email, encryptedEmails))
.catch((err) => {
if (LOG_BACKEND) console.error('Failed to fetch user from database', err);
return null;
})
const encryptedEmails = emails.map(email => encryptColumn(email));

const fetchedUsers = await db
.select({
id: neptun_user.id,
})
.from(neptun_user)
/* @ts-ignore */
.where(inArray(neptun_user.primary_email, encryptedEmails))
.catch((err) => {
if (LOG_BACKEND) console.error('Failed to fetch user from database', err);
return null;
})
7 replies
NNuxt
Created by Jonas on 7/11/2024 in #❓・help
nuxt-auth-utils^0.1.0: Cannot find package 'nitropack'
I am not sure why I am getting this error now. It worked fine for a few hours.
[02:10:37] WARN [plugin node-resolve] Could not resolve import "nitropack/runtime" in A:\xxx\node_modules\.pnpm\n[email protected][email protected][email protected]\node_modules\nuxt-auth-utils\dist\runtime\server\plugins\oauth.js using exports defined in A:\xxx\node_modules\.pnpm\n[email protected][email protected][email protected]\node_modules\nitropack\package.json.

[02:10:38] WARN [plugin node-resolve] Could not resolve import "nitropack/runtime" in A:\xxx\node_modules\.pnpm\n[email protected][email protected][email protected]\node_modules\nuxt-auth-utils\dist\runtime\server\plugins\oauth.js using exports defined in A:\xxx\node_modules\.pnpm\n[email protected][email protected][email protected]\node_modules\nitropack\package.json.

[02:10:38] WARN "nitropack/runtime" is imported by "node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/nuxt-auth-utils/dist/runtime/server/plugins/oauth.js", but could not be resolved – treating it as an external dependency.

[worker reload] [worker init] Cannot find package 'nitropack' imported from A:\xxx\.nuxt\dev\index.mjs 02:13:16

at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
at new NodeError (node:internal/errors:405:5)
at packageResolve (node:internal/modules/esm/resolve:916:9)
at moduleResolve (node:internal/modules/esm/resolve:973:20)
at defaultResolve (node:internal/modules/esm/resolve:1193:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:403:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:372:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39)
at link (node:internal/modules/esm/module_job:75:36)
[02:10:37] WARN [plugin node-resolve] Could not resolve import "nitropack/runtime" in A:\xxx\node_modules\.pnpm\n[email protected][email protected][email protected]\node_modules\nuxt-auth-utils\dist\runtime\server\plugins\oauth.js using exports defined in A:\xxx\node_modules\.pnpm\n[email protected][email protected][email protected]\node_modules\nitropack\package.json.

[02:10:38] WARN [plugin node-resolve] Could not resolve import "nitropack/runtime" in A:\xxx\node_modules\.pnpm\n[email protected][email protected][email protected]\node_modules\nuxt-auth-utils\dist\runtime\server\plugins\oauth.js using exports defined in A:\xxx\node_modules\.pnpm\n[email protected][email protected][email protected]\node_modules\nitropack\package.json.

[02:10:38] WARN "nitropack/runtime" is imported by "node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/nuxt-auth-utils/dist/runtime/server/plugins/oauth.js", but could not be resolved – treating it as an external dependency.

[worker reload] [worker init] Cannot find package 'nitropack' imported from A:\xxx\.nuxt\dev\index.mjs 02:13:16

at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
at new NodeError (node:internal/errors:405:5)
at packageResolve (node:internal/modules/esm/resolve:916:9)
at moduleResolve (node:internal/modules/esm/resolve:973:20)
at defaultResolve (node:internal/modules/esm/resolve:1193:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:403:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:372:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39)
at link (node:internal/modules/esm/module_job:75:36)
I tried installing nitropack as a dev dependency, but that didn't fix it.
8 replies
NNuxt
Created by Jonas on 7/10/2024 in #❓・help
@ai-sdk/vue: How do I react to an error I catch inside `/api` in .vue file?
I am both new to vue and nuxt. How and where do I react to that error, i sent from the api endpoint now? I want to create a new toast message in the frontend on error. This is my code at /api/chat:
import { StreamingTextResponse, streamText } from 'ai';
import { createOpenAI } from '@ai-sdk/openai';

export default defineLazyEventHandler(async () => {
const apiKey = useRuntimeConfig().openaiApiKey;
if (!apiKey) throw new Error('Missing OpenAI API key');

const openai = createOpenAI({
apiKey: apiKey,
});

return defineEventHandler(async (event: any) => {
const { messages } = await readBody(event);

try {
const result = await streamText({
model: openai('gpt-4-turbo'),
messages,
});

return new StreamingTextResponse(result.toAIStream());
} catch (error) {
console.error("AI request errored:", error);
sendError(event, createError({ statusCode: 500, statusMessage: 'Internal Server Error', message: 'AI request errored' }));
}
});
});
import { StreamingTextResponse, streamText } from 'ai';
import { createOpenAI } from '@ai-sdk/openai';

export default defineLazyEventHandler(async () => {
const apiKey = useRuntimeConfig().openaiApiKey;
if (!apiKey) throw new Error('Missing OpenAI API key');

const openai = createOpenAI({
apiKey: apiKey,
});

return defineEventHandler(async (event: any) => {
const { messages } = await readBody(event);

try {
const result = await streamText({
model: openai('gpt-4-turbo'),
messages,
});

return new StreamingTextResponse(result.toAIStream());
} catch (error) {
console.error("AI request errored:", error);
sendError(event, createError({ statusCode: 500, statusMessage: 'Internal Server Error', message: 'AI request errored' }));
}
});
});
How I interact in the frontend:
const { messages, input, handleSubmit, isLoading } = useChat()
const { messages, input, handleSubmit, isLoading } = useChat()
1 replies
DTDrizzle Team
Created by Jonas on 2/29/2024 in #help
ClientAuthentication Error using heroku-postgres
What do I have to do? This one is a heroku-postgres database (actually aws), it worked using a vercel-postgres database.
xxx\node_modules\drizzle-kit\bin.cjs:23472
const message = name === "notice" ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name);

error: no pg_hba.conf entry for host "xxx", user "xxx", database "xxx", no encryption
at Parser.parseErrorMessage (xxx\node_modules\drizzle-kit\bin.cjs:23472:98)
at Parser.handlePacket (xxx\node_modules\drizzle-kit\bin.cjs:23313:25)
at Parser.parse (xxx\node_modules\drizzle-kit\bin.cjs:23237:34)
at Socket.<anonymous> (xxx\node_modules\drizzle-kit\bin.cjs:23513:44)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9)
at Readable.push (node:internal/streams/readable:278:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
at TCP.callbackTrampoline (node:internal/async_hooks:128:17) {
length: 175,
severity: 'FATAL',
code: '28000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '536',
routine: 'ClientAuthentication'
}

Node.js v18.19.0
xxx\node_modules\drizzle-kit\bin.cjs:23472
const message = name === "notice" ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name);

error: no pg_hba.conf entry for host "xxx", user "xxx", database "xxx", no encryption
at Parser.parseErrorMessage (xxx\node_modules\drizzle-kit\bin.cjs:23472:98)
at Parser.handlePacket (xxx\node_modules\drizzle-kit\bin.cjs:23313:25)
at Parser.parse (xxx\node_modules\drizzle-kit\bin.cjs:23237:34)
at Socket.<anonymous> (xxx\node_modules\drizzle-kit\bin.cjs:23513:44)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9)
at Readable.push (node:internal/streams/readable:278:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
at TCP.callbackTrampoline (node:internal/async_hooks:128:17) {
length: 175,
severity: 'FATAL',
code: '28000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '536',
routine: 'ClientAuthentication'
}

Node.js v18.19.0
10 replies