Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fastify error throwing #313

Closed
Calemy opened this issue Jul 7, 2022 · 6 comments · Fixed by #2934
Closed

Fastify error throwing #313

Calemy opened this issue Jul 7, 2022 · 6 comments · Fixed by #2934

Comments

@Calemy
Copy link

Calemy commented Jul 7, 2022

const fastify = require('fastify')()

fastify.listen({ port: 3000 })
console.log("Fastify API running")

this throws an error on behalf of the fasitfy module. i do not know if this is just a fastify issue (which works normal on node) or if this is related to bun.

Error Screenshot

@Jarred-Sumner
Copy link
Collaborator

There are a number of things that need to be fixed before something like fastify will run in Bun:

  • https / http module
  • tty module
  • tls module probably

@s1nistr4
Copy link

Can we reopen this? The error is slightly different but it still doesn't work, this time saying that the port doesn't work.

@Jarred-Sumner Jarred-Sumner reopened this Sep 16, 2023
@SaadFarooq-Dev
Copy link

SaadFarooq-Dev commented Sep 17, 2023

Current Error:

import Fastify from 'fastify'
const fastify = Fastify({
  logger: true
})

// Declare a route
fastify.get('/', function (request, reply) {
  reply.send({ hello: 'world' })
})

// Run the server!
fastify.listen({ port: 4242 }, function (err, address) {
  if (err) {
    fastify.log.error(err)
    process.exit(1)
  }
  console.log(`Server is now listening on ${address}`)
})
image

@sirenkovladd
Copy link
Contributor

@SaadFarooq-Dev in canary it was fixed bun upgrade --canary
#5689

@blankuserrr
Copy link

@SaadFarooq-Dev in canary it was fixed bun upgrade --canary
#5689

do you know if this fix will be implemented in the next stable version of bun?

@Electroid
Copy link
Contributor

This has been fixed as of Bun v1.0.7.

❯ bun fastify.js
Fastify API running
❯ bun fastify.js
{"level":30,"time":1698182897573,"pid":5274,"hostname":"...","msg":"Server listening at http://[::1]:4242"}
{"level":30,"time":1698182897577,"pid":5274,"hostname":"...","msg":"Server listening at http://127.0.0.1:4242"}
Server is now listening on http://[::1]:4242

If you run into the same problem, please feel free to re-open this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants