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

Open
brunolemos opened this Issue Nov 20, 2018 · 20 comments

Comments

@brunolemos
Copy link

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

leo commented Nov 26, 2018

Indeed. The now dev coming is coming soon!

@ckreiling

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

nickerlan commented Dec 7, 2018

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

Is it easier in paid version?

@fr3fou

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

doprdele commented Dec 19, 2018

When will this be released?

@ericclemmons ericclemmons referenced this issue Dec 20, 2018

Closed

now dev #1766

8 of 33 tasks complete
@Metnew

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

DavidBernal commented Dec 26, 2018

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

Feedback is welcome.

@fr3fou

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

DavidBernal commented Dec 27, 2018

@fr3fou totally agree

@fillipvt

This comment has been minimized.

Copy link

fillipvt 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

This comment has been minimized.

Copy link

deadmantfa commented Jan 19, 2019

What is the limit?

@mitevpi

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

WebbizAdmin commented Feb 9, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment