Table of Contents

Serverless Hosting - Now

About

ZEIT Now is a cloud platform for serverless deployment.

It enables developers to host websites and web services (without storage) that deploy instantly, scale automatically, and require no supervision, all with minimal configuration.

Data Persistence

Now is a serverless hosting where the workloads are static or stateless. The data is not stored permanently (only transient)

Request handling

When ZEIT Now processes incoming requests at the network edge:

now.json

Only files that are matched by the src property of a Build are “considered for serving”

{
  "version": 2,
  "name": "next-mysql",
  "alias": "next-mysql.now.sh",
  "builds": [
    { "src": "api/**/*.js", "use": "@now/node" },
    { "src": "next.config.js", "use": "@now/next" }
  ],
  "routes": [
    {
      "src": "/api/profiles/(?<id>[^/]*)",
      "dest": "api/profiles/profile.js?id=$id"
    }
  ],
  "env": {
    "MYSQL_HOST": "@mysql_host",
    "MYSQL_USER": "@mysql_user",
    "MYSQL_PASSWORD": "@mysql_password",
    "MYSQL_DATABASE": "@mysql_database"
  }
}

where:

Log

now log deploymentURL

now.ignore

whitelist recommanded

*
!index.htm
!api/**

Install / Update

yarn global add now

If bad install with Yarn on Windows, change this file:

@"%~dp0\..\Data\global\node_modules\now\download\dist\now.exe" %*

Windows Location ~\AppData\Local\Yarn\Data\global\node_modules\now\download\dist\now.exe

Support

ECONNREFUSED 127.0.0.1:5000

Error! Failed to complete request to /frontend/_next/webpack-hmr: Error: connect ECONNREFUSED 127.0.0.1:5000
Error! Failed to complete request to /frontend/_next/on-demand-entries-ping?page=/: Error: connect ECONNREFUSED 127.0.0.1:5000

Be sure to open your firewall for the now application. With Network - TCPview

Now Port 5000

Documentation / Reference