RUNNb
RUNNb
Explore posts from servers
DTDrizzle Team
Created by RUNNb on 11/10/2024 in #help
Rollback not happening on tx.rollback() [PG DRIVER]
Thank you, I actually just learned about the async callback!
7 replies
DTDrizzle Team
Created by RUNNb on 11/10/2024 in #help
Rollback not happening on tx.rollback() [PG DRIVER]
Also tried without try catch
7 replies
RRailway
Created by ThallesComH on 10/24/2024 in #✋|help
what this error means? trying to deploy latest commit
I also faced the same issue!
33 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
oh ok sorry
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
okok
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
but seeing the disk usage change on the volume it would mean they are going to the volume right?
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
thanks
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
If no futher info is needed, this ticket can be closed 🙂
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
Ok, apparently the image is being saved. I've added a new endpoint to fetch the image content from the volume!
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
The file is being saved now. I've also created an new endpoint to fetch the content from the volume, following the same approach.
options.uploadDir = process.env.RAILWAY_VOLUME_MOUNT_PATH ?
process.env.RAILWAY_VOLUME_MOUNT_PATH : path.join(process.cwd(), "/public/upload_images");

const handler: NextApiHandler = async (req, res) => {
try {
// await fs.readdir(path.join(process.cwd() + "/public", "/upload_images"));
await fs.readdir(process.env.RAILWAY_VOLUME_MOUNT_PATH ?
process.env.RAILWAY_VOLUME_MOUNT_PATH :
path.join(process.cwd() + "/public", "/upload_images"));
} catch (error) {
console.log('directory error: ', error);
// await fs.mkdir(path.join(process.cwd() + "/public", "/upload_images"));
await fs.mkdir(
process.env.RAILWAY_VOLUME_MOUNT_PATH ?
process.env.RAILWAY_VOLUME_MOUNT_PATH :
path.join(process.cwd() + "/public", "/upload_images"));
}

try {
const filename = randomUUID();
const { files } = await readFile(req, filename, true);
// @ts-ignore
const extension = files.image[0]?.newFilename.split('.')[1];
res.json({ done: "ok", filename: `${filename}.${extension}` });
} catch (e) {
console.log('error: ', e);
res.json({ done: "nok" });
}
};

export default handler;
options.uploadDir = process.env.RAILWAY_VOLUME_MOUNT_PATH ?
process.env.RAILWAY_VOLUME_MOUNT_PATH : path.join(process.cwd(), "/public/upload_images");

const handler: NextApiHandler = async (req, res) => {
try {
// await fs.readdir(path.join(process.cwd() + "/public", "/upload_images"));
await fs.readdir(process.env.RAILWAY_VOLUME_MOUNT_PATH ?
process.env.RAILWAY_VOLUME_MOUNT_PATH :
path.join(process.cwd() + "/public", "/upload_images"));
} catch (error) {
console.log('directory error: ', error);
// await fs.mkdir(path.join(process.cwd() + "/public", "/upload_images"));
await fs.mkdir(
process.env.RAILWAY_VOLUME_MOUNT_PATH ?
process.env.RAILWAY_VOLUME_MOUNT_PATH :
path.join(process.cwd() + "/public", "/upload_images"));
}

try {
const filename = randomUUID();
const { files } = await readFile(req, filename, true);
// @ts-ignore
const extension = files.image[0]?.newFilename.split('.')[1];
res.json({ done: "ok", filename: `${filename}.${extension}` });
} catch (e) {
console.log('error: ', e);
res.json({ done: "nok" });
}
};

export default handler;
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
xD
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
see if it detects the path
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
Ahahah, let me try without the /uploads
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
No description
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
i'll try that
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
I've been searching aswell but nothing about this :/
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
here
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
I've tried to do that. I used the second snippet I've sent
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
No description
38 replies
RRailway
Created by RUNNb on 10/27/2023 in #✋|help
How to use volume with nextjs?
No description
38 replies