Bypass for Automation
You can fully bypass any deployment protection using Vercel’s Protection Bypass for Automation feature. With this feature, you can provide a secret in an HTTP header or query parameter to bypass any deployment protection.How to make this work with Checkly?
For any Playwright-powered check, like Browser checks and Multistep checks, you can add the secret to the required HTTP header using thetest.use()
method.
browser-check.spec.ts
request
API, you can add the header to the request.
api-request.spec.ts
- Just add a
x-vercel-protection-bypass
header to the request with the token - Add a query parameter to the request with the token.
- Or use a setup script to manipulate the request before it is sent.
setup-script.js
Vercel Authentication
Vercel has a few different ways to authenticate your deployments. Each work a bit different and require a different approach to make them work with Checkly.Vercel enables Standard Protection by default on all new deployments.
Standard Protection
Standard Protection works by prompting the user to log in to Vercel with their normal Vercel user before they can access the deployment. You can tweak this setting in the Vercel dashboard under Settings > General > Deployment Protection.
How to make this work with Checkly?
- You can completely disable Standard Protection in the Vercel dashboard. This will make your deployments publicly accessible.
- You can add some extra code to a browser check to actually log in to Vercel. Here is an example of how that would work if you are authenticating using GitHub. Note: if you have 2FA enabled on your GitHub account, this will not work.
visit-protected.spec.ts
GITHUB_USER
and GITHUB_PASSWORD
in
the code example) to your Checkly account or as part of the browser check’s environment variables.
Only Preview Deployments
Only Preview Deployments is the same as Standard Protection, but only applies to Preview deployments. This means that we need to tweak the above code a bit to check if we are targeting a Preview deployment or not.How to make this work with Checkly?
We just need to check if the automatically injectedENVIRONMENT_URL
environment variable is set. If it is,
we know we are checking a Preview deployment and we can run the authentication code. If it is not set, we just proceed as normal.
visit-protected.spec.ts
If you have 2FA enabled on your GitHub or other Vercel authentication methods, the above example will not work. You can
explore bypassing 2FA using the
otpauth
library. Check our blog post for more info.