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

Now Dev #1681

Closed
brunolemos opened this issue Nov 20, 2018 · 25 comments
Closed

Now Dev #1681

brunolemos opened this issue Nov 20, 2018 · 25 comments

Comments

@brunolemos
Copy link

@brunolemos brunolemos commented Nov 20, 2018

I'm finding myself having to deploy to test things, specially when they involve redirects like an oauth flow.

I see there's #1672 for @now/next but I didn't find an issue tracking Now Dev in general. It would be much appreciated to have it for all build types, e.g for @now/node with full routing support based on the now.json routes.

And because I have to deploy to test some things, I've been getting Error! You have been creating deployments at a very fast pace. Please slow down. which blocks me from working for an unknown amount of time (seems to be at least 1h).

@paulogdm
Copy link
Member

@paulogdm paulogdm commented Nov 21, 2018

You are completely right @brunolemos. That's why we are developing a tool to simulate the behavior of our platform locally. This is indeed a priority tool for us and should be released very soon!
Stay tuned.

@leo
Copy link
Member

@leo leo commented Nov 26, 2018

Indeed. The now dev coming is coming soon!

@ckreiling
Copy link

@ckreiling ckreiling commented Nov 28, 2018

I can't wait for this tool! I just started using Now today, and am so excited to see what this tool will look like when it becomes available.

@roychri
Copy link

@roychri roychri commented Dec 1, 2018

Until that tool is ready, would it be possible to allow us to perform more deployments before we get asked to slowed down?
And could you tell us how long we have to wait before we can deploy again?
This is frustrating, specially when I had to do so many deployments due to error caused by isomorphic-unfetch issue!

https://spectrum.chat/zeit/general/error-500-after-deploy-success-with-zeit-now~488b2e95-63a3-4825-aa8a-47d7c37047a6

@nickerlan
Copy link

@nickerlan nickerlan commented Dec 7, 2018

Faced the same issue. Couple of test deploys made impossible to continue.

Is it easier in paid version?

@fr3fou
Copy link

@fr3fou fr3fou commented Dec 12, 2018

Seeing that #1672 was closed, what is going to happen? I can't think of a way to use now 2.0 without re-deploying everytime..

@brunolemos
Copy link
Author

@brunolemos brunolemos commented Dec 12, 2018

If you are using mainly @now/node, the current workaround is to create a file that uses micro and micro-router to create a local server with the same routes, then you can run micro-dev locally.

@pmanijak
Copy link

@pmanijak pmanijak commented Dec 16, 2018

If you find yourself here after you wrote a bunch of lambda-capable modules for v2, and you have a working now.json with routes, and a .env file with local variables, and you're using Node, this code might save you some time putting together a local dev server:

require('dotenv').config();

const http   = require('http');
const Router = require('router');
const serve  = require('serve-static');
const done   = require('finalhandler');
const config = require('./now.json');

// Routes
var router = Router();
config.routes.forEach(route => {
   // Ignore wildcard rules
   if (route.dest.includes("$"))
      return;

   var path = '.' + route.dest;
   const code = require(path);
   router.all(route.src, code);
});

// Static files
const www = serve('./public');

// Start server
var server = http.createServer(function (req, res) {
   // Serve routes first then fallback to static files
   router(req, res, function () {
      www(req, res, done(req, res));      
   });
});
server.listen(8080);
@fr3fou
Copy link

@fr3fou fr3fou commented Dec 16, 2018

Seems like a viable solution, for now at least..

What about the future though? Is it going to stay forever as a workaround?
This is a very specific "fix", what about other languages and deployment types?

@pmanijak
Copy link

@pmanijak pmanijak commented Dec 16, 2018

Thanks. Those are good questions, @fr3fou. I'm just someone who ran into the same issue -- sorry I don't know the answers. Maybe all will be revealed with now dev.

@doprdele
Copy link

@doprdele doprdele commented Dec 19, 2018

When will this be released?

@ericclemmons ericclemmons mentioned this issue Dec 20, 2018
8 of 33 tasks complete
@Metnew
Copy link

@Metnew Metnew commented Dec 23, 2018

micro-based solution for routing.

  • Requires routes being set in now.json
  • Supports micro-dev
  • Dynamic require, but it's ok for local development

Works ok so far with ~10 services (API only).

const { routes } = require("./now.json");
const handlers = new Map(
	routes.map(({ src, dest }) => [src, require(`./${dest}`)])
);

module.exports = async (req, res) => {
	const dest = req.url.split("?")[0];
	const fn = handlers.get(dest) || (() => "Not supported!");
	return fn(req, res);
};

routes in now.json

"routes": [
	{
		"src": "/crlf",
		"dest": "crlf/index.js"
	},
	{
		"src": "/subdomains",
		"dest": "subdomains/index.js"
	},
],
@lucasconstantino
Copy link

@lucasconstantino lucasconstantino commented Dec 25, 2018

Just assembled some of the ideas here, and made a lib to help unit testing and locally serving Node lambdas. It respects now.json config, and covers most of the routing complex scenarios, such as URL rewrites. Here it goes: https://github.com/lucasconstantino/now-we-test

p.s.: Merry Christmas!

@DavidBernal
Copy link

@DavidBernal DavidBernal commented Dec 26, 2018

I created this tool:
https://www.npmjs.com/package/@iridium/dev-server

Feedback is welcome.

@fr3fou
Copy link

@fr3fou fr3fou commented Dec 26, 2018

I created this tool:
https://www.npmjs.com/package/@iridium/dev-server

Feedback is welcome.

Will try it out whenever I have a project that will use now, however this (or something similar) really should be built in.

@DavidBernal
Copy link

@DavidBernal DavidBernal commented Dec 27, 2018

@fr3fou totally agree

@fev4
Copy link

@fev4 fev4 commented Dec 29, 2018

Constantly hitting Error! You have been creating deployments at a very fast pace. Please slow down at the moment. How can I avoid this since now dev will take a while?

Any chance the team softens this limit?

@deadmantfa
Copy link

@deadmantfa deadmantfa commented Jan 19, 2019

What is the limit?

@mitevpi
Copy link

@mitevpi mitevpi commented Feb 8, 2019

Just chiming in that I'm also running into this problem repeatedly. @fillipvt and @deadmantfa sum up my thoughts perfectly.

@WebbizAdmin
Copy link

@WebbizAdmin WebbizAdmin commented Feb 9, 2019

I get this too, be nice to be able to go as fast as is needed.

@williamli
Copy link
Member

@williamli williamli commented Feb 27, 2019

How will non javascript endpoints be supported?
Will it be possible to run the monorepo demo from local?

@lucasconstantino
Copy link

@lucasconstantino lucasconstantino commented Feb 27, 2019

@williamli It should definitely rely on Docker.

@PullJosh
Copy link

@PullJosh PullJosh commented Feb 27, 2019

Any update on when this might be released? Even if an initial release can only include support for javascript (node, next js, etc...), having something to work with would be a huge deal.

@paulogdm
Copy link
Member

@paulogdm paulogdm commented Feb 27, 2019

@PullJosh Check #1883

@TooTallNate
Copy link
Member

@TooTallNate TooTallNate commented Mar 27, 2019

The initial iteration of now dev has now been merged into the canary branch (#1883 (comment)). Gonna close this one. Thank you all for your patience.

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

Successfully merging a pull request may close this issue.

None yet