Next.js Discord

Discord Forum

import a json config file in api-route

Common Tern posted this in #help-forum
Open in Discord
Common TernOP
I am trying to pass a json config file to a SDK library. this library gives a Client function that required a path to the config.json file. On my local development this worked without problems but after deploying on Vercel it gave me the error that the client couldn't find the path of the json file.

I think that the config file might not have been uploaded to the server when I am deploying so I tried to import the file into the api route itself as you can see in the screenshot. Now it seems to work well, but I am not sure if this is a good practice and a reccommended way of doing things.
Is there maybe a standard/usual way of doing something like this?

Thank you very much

1 Reply

Black carp
If the path of file is correct then simply pass client(file)