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

Support server.js #4141

Closed
birkskyum opened this issue Aug 13, 2023 · 3 comments · Fixed by #4154
Closed

Support server.js #4141

birkskyum opened this issue Aug 13, 2023 · 3 comments · Fixed by #4154
Labels
bug Something isn't working

Comments

@birkskyum
Copy link
Collaborator

birkskyum commented Aug 13, 2023

server.js - Website - github

What version of Bun is running?

0.7.4+78defe7a87226b5b10766e24fae458a62811dab2

What platform is your computer?

Darwin 22.5.0 arm64 arm

What steps can reproduce the bug?

  • bun init
  • bun add server
  • add this to the index.ts ( example from front page of https://serverjs.io/ )
// Include the server in your file
const server = require('server');
const { get, post } = server.router;

// Handle requests to the url "/" ( http://localhost:3000/ )
server([
  get('/', ctx => 'Hello world!')
]);
  • bun index.ts

What is the expected behavior?

file is excuted, and http://localhost:3000/ will provide a Hello world!

What do you see instead?

Go to http://localhost:3000/ and see:

TypeError: Attempted to assign to readonly property.
    at assign (native)
    at context (/Users/admin/repos/serverjs-test/node_modules/server/server.js:14:44)
    at <anonymous> (/Users/admin/repos/serverjs-test/node_modules/server/server.js:64:39)
    at handle (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/layer.js:94:21)
    at trim_prefix (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:327:41)
    at <anonymous> (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:288:13)
    at process_params (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:349:6)
    at next (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:280:10)
    at expressInit (/Users/admin/repos/serverjs-test/node_modules/express/lib/middleware/init.js:39:9)
    at handle (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/layer.js:94:21)
    at trim_prefix (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:327:41)
    at <anonymous> (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:288:13)
    at process_params (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:349:6)
    at next (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:280:10)
    at query (/Users/admin/repos/serverjs-test/node_modules/express/lib/middleware/query.js:44:9)
    at handle (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/layer.js:94:21)
    at trim_prefix (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:327:41)
    at <anonymous> (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:288:13)
    at process_params (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:349:6)
    at next (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:280:10)
    at handle (/Users/admin/repos/serverjs-test/node_modules/express/lib/router/index.js:176:21)
    at handle (/Users/admin/repos/serverjs-test/node_modules/express/lib/application.js:180:30)
    at app (/Users/admin/repos/serverjs-test/node_modules/express/lib/express.js:38:29)
    at <anonymous> (/Users/admin/repos/serverjs-test/node_modules/engine.io/build/server.js:667:54)
    at <anonymous> (/Users/admin/repos/serverjs-test/node_modules/socket.io/dist/index.js:327:9)
    at emit (node:events:1:2163)
    at fetch (node:http:1:9940)

Additional information

Related to #3955 (comment)

@birkskyum birkskyum added the bug Something isn't working label Aug 13, 2023
@birkskyum birkskyum changed the title Support ServerJS Support server.js Aug 13, 2023
@birkskyum
Copy link
Collaborator Author

Looking at other issues printing TypeError: Attempted to assign to readonly property., my best guess that this is related to:

@paperclover
Copy link
Member

how is worker_threads missing argv at all related to a readonly property assign?

@birkskyum
Copy link
Collaborator Author

can confirm this is resolved by #4154 , thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants