`vc deploy` ignores `.env.local`. To make sure we don't inadvertently
push people's secrets to source control, have all environment pulls
default to writing to `.env.local`.
After many hours of debugging, I tracked down that having an old Node
version (eg 14.x) listed in your Vercel project settings can result in
the build step failing with a confusing and unhelpful error message
"`@vercel/next` No Serverless Pages Built". Note that this is a case
where it "can" cause it to fail, including with NextJS 13.1.6 and Vercel
CLI 28.16.2, but it is not guaranteed to fail. I have six NextJS
projects. They have identical next.config.js, tsconfig.json,
eslintrc.js, and .gitignore files, and other than a few seemingly
non-critical dependencies they have identical package.json files. Four
of the six consistently built and deployed in the cloud without issue.
Two consistently failed to build in the cloud. All built successfully
locally including using vercel build locally, and all would vercel
deploy --prebuilt successfully. Switching all the vercel cloud project
settings from Node 14.x to Node 18.x enabled all the projects to build
and deploy successfully in the vercel cloud without needing local vercel
build and local vercel deploy --prebuilt steps.
---------
Co-authored-by: Steven <steven@ceriously.com>
### Related Issues
This fixes up a few links that had errors I found when scanning through
the code.
### 📋 Checklist
<!--
Please keep your PR as a Draft until the checklist is complete
-->
#### Tests
- [ ] The code changed/added as part of this PR has been covered with
tests
- [ ] All tests pass locally with `yarn test-unit`
#### Code Review
- [ ] This PR has a concise title and thorough description useful to a
reviewer
- [ ] Issue from task tracker has a link to this PR
We have a link to an error page here:
https://github.com/vercel/vercel/blob/main/packages/cli/src/commands/deploy/index.ts#L873,
however that page is currently a 404.
This is an attempt to explain the error a bit more. Because there are
many possible causes of a deployment error, this mostly focuses on
explaining how to get to the logs.
### Related Issues
Fixes https://github.com/vercel/vercel/issues/1732.
### 📋 Checklist
<!--
Please keep your PR as a Draft until the checklist is complete
-->
#### Tests
- [ ] The code changed/added as part of this PR has been covered with
tests
- [ ] All tests pass locally with `yarn test-unit`
#### Code Review
- [ ] This PR has a concise title and thorough description useful to a
reviewer
- [ ] Issue from task tracker has a link to this PR
Co-authored-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Chris Barber <chris.barber@vercel.com>
* [now-cli] Change `now domains add` workflow to match dashboard
* Fix error throwing and add --force
* Remove `now domains verify`
* Count projects when removing a domain
* Include projects for `now inspect`
* Updated `now domains ls`
* Fix `now domains ls`
* Use Finally
* Add tests
* Use --force for domain tests
* Adjust tests
* Adjust test and fix output
* Fix padding
* Adjust more tests
* Ensure the project exists
* Log the deployment
* Fix tests again
* Remove project after test
* Fix command
* Fix test
* Change user after a couple of tests
* Add check
* Use random name for domain
* More logging
* Add more logging
* Remove logging
* Remove .now/project.json every time
* Skip test
* Add test to change user
* More logging
* Use now login
* Remove duplicated test
* Consider linked project for `domains add`
* Fix linting
* Remove unused docs
* Undo changes
* Undo more changes
* Fix typo
* Do not sort projects when there is only one record
* Fix loop
* Deploy with `-V 2`
* Remove verification
* Remove outdated link
* Update packages/now-cli/src/commands/domains/add.ts
Co-authored-by: Steven <steven@ceriously.com>
* Update packages/now-cli/src/commands/domains/add.ts
Co-authored-by: Steven <steven@ceriously.com>
* Use utils for public suffix and service type
* Update packages/now-cli/src/commands/domains/ls.ts
Co-authored-by: Steven <steven@ceriously.com>
* Update packages/now-cli/src/commands/domains/add.ts
Co-authored-by: Steven <steven@ceriously.com>
* Change link
* Undo test changes
* Fix type issues
* Update packages/now-cli/src/commands/domains/add.ts
Co-authored-by: Steven <steven@ceriously.com>
* Use domain config to print info
* Check apex domain when removing a domain
* Remove psl
* List projects when removing a domain
* Do not list projects
* Change user earlier
* Update packages/now-cli/src/commands/domains/inspect.ts
Co-authored-by: Steven <steven@ceriously.com>
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>
* Apply suggestions from code review
Co-authored-by: Steven <steven@ceriously.com>
Co-authored-by: Mark Glagola <mark.glagola@gmail.com>
Co-authored-by: Steven <steven@ceriously.com>
As discussed this adds opting out of the shared lambdas optimization when a user adds a functions config in `now.json` or `vercel.json` since this could potentially be a breaking change. We plan to add new handling to still allow customizing this config for the combined lambdas that are created
As discussed this de-experimentalizes the shared lambdas optimization now that we have tested it, it also bails out of the optimization when a `now.json` or `vercel.json` is detected that contains legacy routes
We renamed the GitHub repository from `zeit/now` to `vercel/vercel` so this PR updates all references to the repo URL.
There were also a few remaining references to Now CLI that have been updated to Vercel CLI.
This PR renames the CLI and config files to `vercel`.
https://vercel.com/blog/zeit-is-now-vercel
### Complete
- [x] Help menus and error messages should print cli name from `package.json`
- [x] `now.json` => `vercel.json`
- [x] `.nowignore` => `.vercelignore`
- [x] `~/.now` => `~/.vercel`
- [x] `<project>/.now/project.json` => `<project>/.vercel/project.json`
### TODO
I'm going to do the remaining work in a follow-up PR:
- [ ] `<project>/.now/cache` => `<project>/.vercel/cache` (Runtimes sometimes use this)
- [ ] `NOW_*` special cased environment variables
- [ ] `*.now.sh` special cased url suffix
This updates the error message shown when we fail to load the `routes-manifest` which appears to be happening most often when an incorrect output directory is configured for a Next.js application
- Print an error instead of throwing when `destination` has segment not found in `source`
- Update docs to explain how to fix this error
- Add a couple tests
- Update uncaught `path-to-regexp` error message to print the full route that caused the error
This PR fixes an issue where certain patterns caused `path-to-regexp` to throw when it should be returning an error object. The fix is to make sure all inputs work properly with `path-to-regexp` before continuing.
Fixes#3334.
```
$ node ~/now-cli/dist/index.js --token $'he˚ll,o\n'
> Error! You defined "--token", but its contents are invalid. Must not contain: "\n", ",", "˚"
> More details: https://err.sh/now/invalid-token-value
```
* Update links to `now-builders` repo to `now` repo
Also copies over the `.md` files from the now-builders' `errors`
directory so that the https://err.sh links work correctly.
Part of #2782.
* Update `err.sh` links that were formerly `now-cli`
* Empty commit for CI
* Make CircleCI `run.sh` script a bit better
Before it would fail with exit code 1 if there were no matching modified
files because of the `grep` call failing without any `packages` prefixed
files.
* Do not report env errors to Sentry
* Added guide for missing env file in dev mode
* Update errors/missing-env-file.md
Co-Authored-By: leo <mindrun@icloud.com>
* Update errors/missing-env-file.md
Co-Authored-By: leo <mindrun@icloud.com>
* Added basics for new --scope flag
* Fixed usage information
* Fixed integration test
* Fixed usage information about whoami
* Brought back missing whitespace
* Do not push scope property to API
* Ensure we're only reading local config in one place
* Fixed build
* Added test
* Made scope from config work
* Correctly handle error
* Handle Now errors too when loading local config
* Removed NowError
* Revert "Removed NowError"
This reverts commit cfeebc65251d3eb07f9aeb3e548af1d23c00a18e.
* Fixed CI
* Fixed final bug
* Do not consider switch command
* Made it work as expected
* Added test
* Added yet another test for the scope property
* Added space
* Move deploy command to its own directory
* Do not show success on downscale message
* Move getDeploymentByIdOrHost to /util/deploy
* Remove unneeded parameter in getAppName
* Better types for copyToClipboard
* Update to babel 7
* Add generator utility functions
* Add function to get deployment events
* Finish getDeploymentEvents after getting one state-change event
* Refactor deploy events and reduce verification timeout
* Reduce verification timeout for scale and alias
* Use output.log for success message in scale
* Fix integration tests
* Introduce v3 deployment scaling API
* Less retries on setScale()
* now scale cmd v3
* Deployment id fixes
* bump `ecmaVersion` we lint against, to consider object rest spread
* move EPIPE workaround to the main file
* uniform exiting approach
* clean up list command to avoid globals, be simpler to read
* add ability to supply a custom API version to `now.list()` helper
* upgrade babel toolchain
* introduce `arg`, which will incrementally replace `mri`
* global args accepted by all subcommands
* update lock
* fix `>` to be red when rendering errors
* use new output helpers by @tootallnate
* make object spread work
* bump flow webpack plugin
* lock
* revert to ava 0.25.x
* deprecate `now ls help` since an app could be named `help`
* validate number of arguments
* Fixed integration tests to match downgraded AVA
* Trimmed newline
* WIP
* whitespace fix
* add source map support by @timneutkens
* fix source maps paths
* remove sort-deployments util. it only considers `package.json`
* created -> age for consistency
* remove sorting what wasn't working well
* multiple improvements and simplifications
* improve rendering of urls, fix filtering by app
* only attempt to fetch instances if we have a count > 0
* better check for no deployments
* add instance lists if --all is supplied
* prevent the `.map` file from being included by pkg
* Store artifacts in Circle CI
* adapt INITIALIZING display by suggestion of @tootallnate
* Nothing to return
* now scale: Args parsing and remove ls
* various code improvements, error link for deprecation of `now scale ls`
* improve help
* make error more specific to deployment
* use new error output utilities for `now deploy`
* make some requires conditional
* default command style fix
* add reusable dc validation and normalization utilities
* start doing dc / region validation in scale
* refactor deploy to use reusable dc / region utils
* add slug support for warn util
* add success helper
* improve `scale` command
* add `responseErrorMessage` helper
* add `now.fetch()` helper
* remove console.log
* tweak output
* draft of verification step
* better errors
* implement (customizable) verification timeout
* bump now-host api to v3
* finish verification
* improve verification and sanitization
* improve copy
* fix ctrl+c during scale
* fix max scale in the absense of max
* improved rules saving
* fix listing the context you're running `now list` under
* add context name to list commands from slots
* improve --no-verify
* add 'elapsed' utility to print out the elapsed time nicely
* add per-dc timers
* improve debug helper to save date, improve time helper to log eagerly
* log every request, automatically
* tweak
* general tweaks to `now deploy`
* pass additional now config fields
* refactor `now rm`
* begin `inspect` command
* bump fetch-h2
* nearly complete new inspect command
* add `(dev)` to --version while in development
* fix 404 error if app is not matched
* improve scaling
* pass event types to the events endpoint
* fix file uploads
* fix passing a deployment hostname with trailing `/`
* fetch events only for non-static
* include uid in inspect
* finish up events
* reduce one indent by recommendation of @leo
* fix debugging for `now ls`
* Always return and exit at top-level in now.js
* improved scale message
* more elegant way of exiting, allowing for resource cleanup & faster
* flowify
* fix strange error which happens when orderly cleanup is done
* flow
* flow fix
* invoke now.close()
* improve list indentation
* refactor alias
* exit clean
* improve fallthrough entry in path alias
* make scale exit properly
* fix closing agent for inspection
* add type of deployment to ls
* better error handling of 403
* improve list style
* various algorithmic improvements
* Certificates refactor to consume the new API (#1210)
* Adapt cert command to the new api
* Use the new certs api for cert command
* Console log certs table and point to the right endpoint
* Remove unused certs client file
* Refactor certs commands
* Fix access to args
* Always close client
* Refactor alias (#1216)
* remove unnecessary file
* reads events from /deployment/:id/events endpoint (#1219)
* add polling (#1220)
* add polling
* hack to prevent partial json to be unluckily parsed in _flush
* cleanupAndResolveCalled to prevent running twice
* call onOpen only of going to 'log'. also call from cleanup
* callOnOpenOnce, don't reject on stream error, polling to finish
* fix eraseLines, make cleanup routine reject
* remove build-logger.js
* restored printEvent from deleted build-logger.js
* print locations of instance events
* bump api versions
* Switch now logs to events endpoint (#1223)
* move eraseLines to onRetry. show error in onRetry
* move printEvents to 'sh/util/events.js'
* use printEvents in `now logs` command
* pass printEvent to events.js
* make both follow and non-follow modes work
* remove socket.io
* improve logs command
* clarify team context
* Refactor alias
* Use ellapsed util in stamp
* use v3
* Refactor alias (#1224)
* Refactor alias
* Use ellapsed util in stamp
* Improvements
* Fix unit tests
* Ensure body exists when copying error attrs
* Add hook to close socket and wait message on process exit
* More retries when verifying the DNS records in alias
* Remove nowExit event listener on close
* Add remaning DCs message right away on alias
* Consistent timestamp when creating a deployment + scale dcs
* Ignore flow error
* Remove not needed now.close from alias
* Remove not needed now.close from inspect
* Bugfix: bind context to close socket handler
* Better error handling for scale command
* Now logs limit (#1226)
* restored -n LIMIT cli arg
* show date in format usabe for since and until
* pass direction and limit to endpoint
* implement follow mode after backwards slice
* add query, fix linefeeds, strip term commands
* implement head argument
* better logs default
* logs: fix -o raw mode, fix all mode
* Add verification for deploy
* Run integration tests using random email address
* Fix flow errors
* Fix wrong scale check
* Finish deploy on state READY
* Correct URL parsing
* Bumped Node.js to the latest version
* Output node version
* fix url display
* Returned URLs
* Improve messages in scale
* Clear URLs
* Strip ANSI codes
* Better logging messages for deploy
* Print ls to console instead of stderr
* Add create certificate certificate and ensure verification is done for a domain
* Write success in alias to stdout
* clearURL in stdout for alias test
* Update scale integration test
* Use stdout for scale success message
* Write alias rm response to stdout
* Refactor alias rm to use fetch from now client
* Fix tests