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

Cannot run "s local start" with two HTTP functions in the same project #78

Open
QYongHao opened this issue Aug 12, 2023 · 0 comments
Open

Comments

@QYongHao
Copy link

QYongHao commented Aug 12, 2023

I added a second HTTP function in my serverless-devs project and tried to run "s local start" but would receive the error:

Error: listen EADDRINUSE: address already in use :::7305

This appears to be because the local function compute server starts up the functions on the same localhost port, causing the second function to fail because the first function already occupies a port.

Is there any way to have multiple HTTP functions running locally?

Full stack trace below:

~/ros-cdk-typescript/function/start-fc-http-nodejs14$ s local start
[2023-08-11 19:18:49] [INFO] [S-CORE] - It is detected that your project has the following projects < helloworld,next-function > to be execute
[2023-08-11 19:18:49] [INFO] [S-CORE] - Start executing project helloworld
[2023-08-11 19:18:49] [INFO] [FC-LOCAL-INVOKE] - Using trigger for start: 
name: httpTrigger
type: http
config:
  authType: anonymous
  methods:
    - GET

[2023-08-11 19:18:49] [INFO] [FC-LOCAL-INVOKE] - CustomDomain localhost:1234 of hello-world-service/start-fc-http-nodejs14 was registered
        url: http://localhost:7305/
        methods: GET
        authType: anonymous

Tips for next step
======================
* Deploy Resources: s deploy
[2023-08-11 19:18:49] [INFO] [S-CORE] - Project helloworld successfully to execute 

[2023-08-11 19:18:49] [INFO] [S-CORE] - Start executing project next-function
function compute app listening on port 7305!

[2023-08-11 19:18:49] [INFO] [FC-LOCAL-INVOKE] - Using trigger for start: 
name: httpTrigger
type: http
config:
  authType: anonymous
  methods:
    - GET

[2023-08-11 19:18:49] [INFO] [FC-LOCAL-INVOKE] - HttpTrigger httpTrigger of hello-world-service/next-function-example was registered
        url: http://localhost:7305/
        methods: GET
        authType: anonymous

Tips for next step
======================
* Deploy Resources: s deploy
[2023-08-11 19:18:49] [INFO] [S-CORE] - Project next-function successfully to execute 

helloworld: 
  status: succeed
next-function: 
  status: succeed
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::7305
    at Server.setupListenHandle [as _listen2] (node:net:1740:16)
    at listenInCluster (node:net:1788:12)
    at Server.listen (node:net:1876:7)
    at Function.listen (/home/qstevens/.s/components/devsapp.cn/devsapp/fc-local-invoke/dist/index.js:71795:24)
    at FcLocalInvokeComponent.startExpress (/home/qstevens/.s/components/devsapp.cn/devsapp/fc-local-invoke/dist/index.js:236088:34)
    at FcLocalInvokeComponent.<anonymous> (/home/qstevens/.s/components/devsapp.cn/devsapp/fc-local-invoke/dist/index.js:236238:18)
    at Generator.next (<anonymous>)
    at fulfilled (/home/qstevens/.s/components/devsapp.cn/devsapp/fc-local-invoke/dist/index.js:236029:58)
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1767:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'EADDRINUSE',
  errno: -98,
  syscall: 'listen',
  address: '::',
  port: 7305
}
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

No branches or pull requests

1 participant