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

run serverless info when running serverless dev #12541

Closed
1 task done
gsavvidis96 opened this issue May 25, 2024 · 7 comments
Closed
1 task done

run serverless info when running serverless dev #12541

gsavvidis96 opened this issue May 25, 2024 · 7 comments
Labels

Comments

@gsavvidis96
Copy link

Is there an existing issue for this?

  • I have searched existing issues, it hasn't been reported yet

Use case description

when running serverless dev the user has to go and find the endpoint url in case they have httpApi events attached. So they got to go to aws dashboard or run serverless info for the same environment they run the dev command.

Proposed solution (optional)

It would be nice to log the stage's info when running serverless dev

@senghuotlay
Copy link

it will go against your deployment's endpoint, acting as a barier, therefore i think it's suggested to have a local env deployment against that

@gsavvidis96
Copy link
Author

gsavvidis96 commented May 25, 2024

Sorry I did not understand what you mean. What I mean is that I run serverless dev and I just see Connected (Ctrl+C to cancel) so in order to invoke a function for example in postman I need to know its endpoint. To find that I got to run a second command in another terminal serverless info and copy and paste the endpoint from there while it could just be

service: XX
stage: XX
region: XX
stack XX
endpoint: GET - https://XXX
functions:
  XXX: XX-dev-XX
  
Connected (Ctrl+C to cancel)

After invoking the serverless dev command

@austencollins
Copy link
Member

@gsavvidis96 Yep, we felt the need for this too in after we POC'd the first version in our team. Now, here's what we are working on, please let us know what you think or if you have other suggestions:

  • Dev Mode should print the basic essential info upon start (domain, etc.)
  • Dev Mode should be an interactive terminal session, which still allows for input.
  • Dev Mode's terminal session input should allow for easy invoking of AWS Lambda and emulation of several types of event payloads, beyond just API requests—all in the CLI.

@senghuotlay
Copy link

couple of questions to have @ac360, what will happen when multiple people are running serverless dev at the same time, how will will u be able to intercept which one, and after you've closed your terminal, will it crashes the serer?

@gsavvidis96
Copy link
Author

@gsavvidis96 Yep, we felt the need for this too in after we POC'd the first version in our team. Now, here's what we are working on, please let us know what you think or if you have other suggestions:

  • Dev Mode should print the basic essential info upon start (domain, etc.)
  • Dev Mode should be an interactive terminal session, which still allows for input.
  • Dev Mode's terminal session input should allow for easy invoking of AWS Lambda and emulation of several types of event payloads, beyond just API requests—all in the CLI.

I think it will be perfect that way, can't think of anything more currently.

@austencollins
Copy link
Member

@senghuotlay Multiple people should not run serverless dev at the same time in the same Stage, or the feature will only work for one of them, since the events can only be proxied to one user's machine at a time. To avoid this, teammates should use personal Stages, rather than work on a shared development Stage together. Or, if sharing the same development Stage, if logic is broken up across multiple Services, teammates can work on a Service individually in the same Stage. We realize this isn't ideal, but it's a limitation of cloud architecture generally. We have something in the works that will solve this problem perfectly, which we aim to unveil in Q3.

If the terminal session is closed and a deployment does not happen to restore the original environment using a regular serverless deploy, the AWS Lambda functions will still be instrumented with dev mode and will not work, since they will be reaching out to a local machine which is no longer connected. Always remember to run a regular deploy after dev mode.

This is only the first version of the feature and about ~10% of our vision here. We'll be shipping a lot more in this direction shortly. Keep the feedback coming!

@austencollins
Copy link
Member

We're still working on lots of improvements here, but until then, we've pushed the initial suggestion to show endpoints (and functions) at the beginning of Dev Mode. Run serverless update to get it.

https://github.com/serverless/serverless/releases/tag/v4.0.33

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

No branches or pull requests

3 participants