Skip to content

Bun with Elysia SIGHUP when reading file #4879

Closed

Description

@xzones2014

What version of Bun is running?

1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

.get("/file", () => Bun.file("./src/halo.json"))

What is the expected behavior?

just show the file content

What do you see instead?

then open that path on the browser, immediately exit without stack trace info
console show
error: script "dev" exited with code 1 (SIGHUP)

Additional information

No response

Activity

  1. yoroshikun commented on Sep 11, 2023

    @yoroshikun

    https://bun.sh/docs/api/file-io

    try Bun.file("./src/halo.json").text() <- convert to text, not just reference.

    Do your best to practice defensive programming for bugs.
    The above will error if the file doesn't exist etc. so try to write some catches etc to prevent your program from crashing.

  2. xzones2014 commented on Sep 11, 2023

    @xzones2014
    Author

    https://bun.sh/docs/api/file-io

    try Bun.file("./src/halo.json").text() <- convert to text, not just reference.

    Do your best to practice defensive programming for bugs. The above will error if the file doesn't exist etc. so try to write some catches etc to prevent your program from crashing.

    i did many ways, but still not found the cause

    .get("/puyeng", async() => {
        
        const file = Bun.file("package.json");
        const res = {
          size : file.size
        }
        if (file.size){
          try {
            const isi = await file.text()
            console.log(`isi : ${isi}`)
            return new Response( file )
            
          } catch (error) {
            console.log(error)
          }
        } 
        return res
       
      })
    

    that code above still panic without meaningful error , SIGHUP immediately when reaching the line .text()

  3. Willbill360 commented on Sep 11, 2023

    @Willbill360

    I'm having the same issue with the same simple code:

    try {
        const input = await file('./package.json').text() // .json() also breaks
        console.log(input)
    } catch(e) {
        console.error(e)
    }

    Even a Try-Catch doesn't reveal any errors and the process still stops with a SIGHUP error. The catch is not even being executed.

    Also, it doesn't appear to be related to Elysia, as my project doesn't use it.

    Output:
    error: script "start" exited with code 1 (SIGHUP)

  4. Speaker4TheUndead commented on Sep 14, 2023

    @Speaker4TheUndead

    Experiencing same issue on Ubuntu. I'm also using Elysia Html.

  5. iamcsharper commented on Oct 5, 2023

    @iamcsharper

    same thing on WSL 2

  6. iamcsharper commented on Nov 7, 2023

    @iamcsharper

    @Jarred-Sumner sorry to bother you, but will this issue be addressed?

  7. hex2f commented on Jan 6, 2024

    @hex2f
    Contributor

    Hmm, this is still happening for me in versions 1.0.18 and forwards. Works fine in 1.0.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions