#Error when importing library

1 messages · Page 1 of 1 (latest)

halcyon ice
#

"TypeError: The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of URL" ?? I don't understand. Why is it erroring when it's receiving URL when it expects URL?

silver auroraBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

halcyon ice
#

Is this some client-server thing I'm not getting

nocturne burrowBOT
tame solar
#

sorry wrong one

nocturne burrowBOT
# halcyon ice "TypeError: The "path" argument must be of type string or an instance of Buffer ...
Please add more information to your question

Your question currently does not have sufficient information for people to be able to help. Please add more information to help us help you, for example: relevant code snippets, a reproduction repository, and/or more detailed error messages. See more info on how to ask a good question in https://discord.com/channels/752553802359505017/1138338531983491154 and #welcome message.

tame solar
#

can you add code or something

halcyon ice
#
import { z } from "zod";
import nspell from 'nspell'
import dictionary from 'dictionary-en'
import {
    createTRPCRouter,
    publicProcedure,
} from "~/server/api/trpc";

const spellcheck = nspell(Buffer.from(dictionary.aff), Buffer.from(dictionary.dic))

export const wordRouter = createTRPCRouter({
    isWord: publicProcedure
        .input(z.object({ word: z.string() }))
        .query(({ input }) => {
            return spellcheck.correct(input.word);
        }),
});
#

It errors on the import of dictionary

#

But the thing is on a different page where it's being imported that doesn't happen

tame solar
#

it was last published 2 years ago...

halcyon ice
#

but from my main page no

tame solar
#

Are you importing the file which imports this specific package in the middleware?

halcyon ice
#

But I'm using that trpc route in 2 different files

#

and in only one it works

tame solar
#

are any of your routes edge runtime

halcyon ice
#

No

#

The difference between them is one is server component and one is client

#

when I used .useQuery() for it on the client it worked fine
when i just fetched it on the server i get an error

tame solar
#

Are yous ure you get the error in import, or do you get it with nspell or something?

halcyon ice