Next.js Discord

Discord Forum

uncaughtException Error: write EPIPE while deloying on vercel

Answered
West African Lion posted this in #help-forum
Open in Discord
Avatar
West African LionOP
While deploying my Nextjs site on Vercel I ran into the following Error
uncaughtException Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:160:15)
    at writeGeneric (node:internal/stream_base_commons:151:3)
    at Socket._writeGeneric (node:net:930:11)
    at Socket._write (node:net:942:8)
    at writeOrBuffer (node:internal/streams/writable:392:12)
    at _write (node:internal/streams/writable:333:10)
    at Writable.write (node:internal/streams/writable:337:10)
    at console.value (node:internal/console/constructor:300:16)
    at console.log (node:internal/console/constructor:377:26)
    at Object.info (/vercel/path0/node_modules/next/dist/build/output/log.js:79:13) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'



I am having trouble pin pointing the problem and whats causing it
Answered by West African Lion
solved
View full answer

4 Replies

Avatar
West African LionOP
Complete Logs

Running build in Cleveland, USA (East) – cle1
Cloning github.com/studentdevelops/Face-Detect-Rework (Branch: main, Commit: a07e6a6)
Previous build cache not available
Cloning completed: 431.394ms
Running "vercel build"
Vercel CLI 31.0.1
Installing dependencies...
added 437 packages in 14s
126 packages are looking for funding
  run `npm fund` for details
Detected Next.js version: 13.4.8
Detected `package-lock.json` generated by npm 7+...
Running "npm run now-build"
> face-detection@0.1.0 now-build
> next build | npx prisma generate
Prisma schema loaded from prisma/schema.prisma
✔ Generated Prisma Client (4.16.2 | library) to ./node_modules/@prisma/client in 149ms
You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
`
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
`
uncaughtException Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:160:15)
    at writeGeneric (node:internal/stream_base_commons:151:3)
    at Socket._writeGeneric (node:net:930:11)
    at Socket._write (node:net:942:8)
    at writeOrBuffer (node:internal/streams/writable:392:12)
    at _write (node:internal/streams/writable:333:10)
    at Writable.write (node:internal/streams/writable:337:10)
    at console.value (node:internal/console/constructor:300:16)
    at console.log (node:internal/console/constructor:377:26)
    at Object.info (/vercel/path0/node_modules/next/dist/build/output/log.js:79:13) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}
Found next.config.js:
/** @type {import('next').NextConfig} */
const nextConfig = {
    images: {
        remotePatterns: [
            {
                hostname: "*"
            },
        ],
    }
}

module.exports = nextConfig
Error: No serverless pages were built
Learn More: https://err.sh/vercel/vercel/now-next-no-serverless-pages-built
at first i thought the code in app/page.js
this particular code was causing the issue
const image = e.target.files[0];
const reader = new FileReader();

const ImageData = await new Promise((resolve, reject) => {
reader.addEventListener("load", () => {
resolve(reader.result);
});
reader.readAsDataURL(image);
}, false);

method: onUploadClick, but removing it and deploying again was still casuing the same issue

I changed approch again decided to use fs to save the images directly into the public/uploads/ folder
still ran into the same issue

Right now using cloudify to upload images, still have same issue

Would love to know an alternate approch as well as how to fix it 😭
Avatar
West African LionOP
solved
Answer