menu

ZEIT

Our mission is to make cloud computing as easy and accessible as mobile computing. You can find our Next.js community here.

Channels
Team

$ now --target doing nothing

March 20, 2019 at 1:41pm

$ now --target doing nothing

March 20, 2019 at 1:41pm (Edited 1 month ago)

Hey now lovers,

I just see you new feature about the aliasing and the target on deployment. This is really promising!

I was trying to use it on my project, but event with the last now-cli package (14.2.0), it seems to not do special aliasing at the end of the deployment:

$ now --target staging
> Deploying ~/workspace/myproject under myorg
> Using project myproject
> https://myproject-arv1hclju.now.sh [v2] [8s]
┌ package.json Ready [5m]
├── android-chrome-192x192.png (2.97KB)
├── android-chrome-512x512.png (10.09KB)
├── apple-touch-icon.png (2.69KB)
├── asset-manifest.json (1.31KB)
├── browserconfig.xml (246B)
├── favicon-16x16.png (843B)
├── favicon-32x32.png (1.35KB)
├── favicon.ico (14.73KB)
├── index.html (2.71KB)
├── mstile-150x150.png (2.43KB)
├── precache-manifest.7fe85f0cda46fc211bfdd25cf162a001.js (1.42KB)
├── safari-pinned-tab.svg (30.51KB)
├── service-worker.js (1.02KB)
├── site.webmanifest (550B)
├── static/js/runtime~main.229c360f.js (1.47KB)
├── static/js/runtime~main.229c360f.js.map (7.81KB)
├── static/media/Panton-ExtraBold.27c93ed8.woff (48.44KB)
├── static/media/Panton-ExtraBold.cbc22c6b.woff2 (31.27KB)
├── static/media/Panton-Light.1afe7f1e.woff (42.66KB)
├── static/media/Panton-Light.ad594344.woff2 (30.36KB)
├── static/media/Panton-SemiBold.23907e32.woff (44.19KB)
├── static/media/Panton-SemiBold.f575f5aa.woff2 (31.64KB)
├── textures/cursor.png (7.31KB)
├── static/media/Panton-ExtraBold.c4bdc519.ttf (103.96KB)
├── static/media/Panton-Light.c96c43f1.ttf (100.77KB)
├── static/media/Panton-SemiBold.847f435b.ttf (105.82KB)
├── static/js/main.a9f724a9.chunk.js (477.96KB)
├── static/js/main.a9f724a9.chunk.js.map (912.86KB)
├── static/js/1.7dfe2c27.chunk.js (4.99MB)
└── static/js/1.7dfe2c27.chunk.js.map (17.33MB)
> Success! Deployment ready [5m]

As you can see there is no special aliasing at the end of the output (like in the blog post).

My application use a pretty standard CRA now setup:

{
"version": 2,
"name": "myproject",
"scope": "myorg",
"alias": ["myproject.myorg.app"],
"builds": [
{
"src": "package.json",
"use": "@now/static-build",
"config": { "distDir": "build" }
}
],
"routes": [
{
"src": "^/static/(.*)",
"headers": { "cache-control": "s-maxage=31536000,immutable" },
"dest": "/static/$1"
},
{ "src": "^/asset-manifest.json", "dest": "/asset-manifest.json" },
{ "src": "^/favicon.ico", "dest": "/favicon.ico" },
{ "src": "^/precache-manifest.(.*)", "dest": "/precache-manifest.$1" },
{
"src": "^/service-worker.js",
"headers": { "cache-control": "s-maxage=0" },
"dest": "/service-worker.js"
},
{ "src": "^/site.webmanifest", "dest": "/site.webmanifest" },
{
"src": "/",
"status": 301,
"headers": { "Location": "/program" }
},
{
"src": "^/(.*)",
"headers": { "cache-control": "s-maxage=0" },
"dest": "/index.html"
}
]
}

Did you have any idea of what I'm doing wrong?


March 20, 2019 at 1:56pm

Can you try our canary CLI release?

  • reply
  • like

npm i -g now@canary

  • reply
  • like

Same result with now canary 14.3.0-canary.13

  • reply
  • like

@spy-seth Can you please post a deployment URL or DM on to me so that we can investigate further?

Edited
  • reply
  • like

Where is the documentation around the --target flag? All I see is the command line description: --target Deploy to either 'staging' or 'production' aliases But searching the v2 docs for target or alias don't seem to spell out what happens when you use the target flag. Works for production value (equivalent to the deprecated 'now alias' command which gets alias from now.json)

But guessing sucks - update the docs please :-)

Tom

Edited
like-fill
2
  • reply
  • like

I tried on 14.2.0 and 14.3.0-canary.13 with --target production and it didn't create any alias.

Edited
  • reply
  • like

March 21, 2019 at 8:09am

Same issue here it seems:

~/Developer/ayrton/remotestories/redirect [now-automatic-aliasing $]
$ now -v
14.3.0-canary.16
~/Developer/ayrton/remotestories/redirect [now-automatic-aliasing $]
$ now --target staging
> Deploying ~/Developer/ayrton/remotestories/redirect under remotestories
> Using project remotestories-redirect
> https://remotestories-redirect-ocq8u0oh3.now.sh [v2] [6s]
> Success! Deployment ready [6s]
~/Developer/ayrton/remotestories/redirect [now-automatic-aliasing $]
$ now --target production
> Deploying ~/Developer/ayrton/remotestories/redirect under remotestories
> Using project remotestories-redirect
> https://remotestories-redirect-h8aq14wf0.now.sh [v2] [5s]
> Success! Deployment ready [5s]
{
"name": "remotestories-redirect",
"version": 2,
"alias": "remotestories.com",
"scope": "remotestories",
"routes": [
{
"headers": { "Location": "https://www.remotestories.com/$1" },
"src": "/(.*)",
"status": 301
}
]
}
  • reply
  • like

When I deploy from my CD server with now-cli v14.2.2 the deployment is successfully aliased at the end of the process:

$ now --token=${NOW_TOKEN} --build-env REACT_APP_API_ENDPOINT=$REACT_APP_API_ENDPOINT --build-env REACT_APP_DEPLOYMENT_ENVIRONMENT=$REACT_APP_DEPLOYMENT_ENVIRONMENT deploy
[...]
> Ready! Aliased to https://myproject-aabricmyorg.myorg.now.sh [3m]
https://myproject-nrstyries.now.sh
  • reply
  • like

Please, try our latest canary release and let me know: npm i -g now@canary

  • reply
  • like

It's working! 🕺

  • reply
  • like

That's perfect :)

  • reply
  • like

This feature is very promising. But for now the lack of way to use a custom domain for the staging environment make it less powerful than it could be

like-fill
1
  • reply
  • like

By allowing two targets in the alias key, it could allow to choose both urls:

{
"alias": {
"staging": ["staging.mydomain.com"],
"production": ["mydomain.com"],
}
}
Edited
like-fill
1
  • reply
  • like

Please, try our latest canary release and let me know: npm i -g now@canary

One other than 14.3.0-canary.16?

  • reply
  • like

now@14.3.0-canary.16

➜ redirect git:(master) now --name meetmagento.pl --target production
> Deploying ~/Sites/meet-magento-website/redirect under snowdog
> Using project meetmagento.pl
> https://meetmagentopl-goaju4epr.now.sh [v2] [5s]
> Success! Deployment ready [5s]

My now.json

{
"version": 2,
"alias": ["www.meetmagento.pl"],
"routes": [
{
"src": "/(.*)",
"status": 301,
"headers": { "Location": "https://meetmagento.pl/$1" }
}
]
}

So it should be aliased to www.meetmagento.pl

Edited
  • reply
  • like

This feature is very promising. But for now the lack of way to use a custom domain for the staging environment make it less powerful than it could be

The intention is to support that customization

like-fill
1
  • reply
  • like

now@14.3.0-canary.16

➜ redirect git:(master) now --name meetmagento.pl --target production
> Deploying ~/Sites/meet-magento-website/redirect under snowdog
> Using project meetmagento.pl
> https://meetmagentopl-goaju4epr.now.sh [v2] [5s]
> Success! Deployment ready [5s]

My now.json

{
"version": 2,
"alias": ["www.meetmagento.pl"],
"routes": [
{
"src": "/(.*)",
"status": 301,
"headers": { "Location": "https://meetmagento.pl/$1" }
}
]
}

So it should be aliased to www.meetmagento.pl

It is working correctly no?

  • reply
  • like

One other than 14.3.0-canary.16?

.16 is the latest... Can you describe your problem?

  • reply
  • like

.16 is the latest... Can you describe your problem?

No alias are assigned to my deployment, eg: link

Edited
  • reply
  • like

I think this might be similar/related to the issue posted in this thread

  • reply
  • like

If you can offer us more resources, like a deployment link, screenshots, etc. we will investigate it! You can DM me if you prefer.

  • reply
  • like

It is working correctly no?

Nope. If I understand it correctly how this feature should work, with --target production it should automatically alias the deployment to the url taken from now.json, but it doesn't.

  • reply
  • like

But you quoted that your now.json is:

{
"version": 2,
"alias": ["www.meetmagento.pl"],
"routes": [
{
"src": "/(.*)",
"status": 301,
"headers": { "Location": "https://meetmagento.pl/$1" }
}
]
}

The URL is www.meetmagento.pl which will be aliased as a production target.

  • reply
  • like

I am sorry, it was brought to my attention we indeed have a bug @igloczek .

  • reply
  • like

I will keep you posted. Sorry for the confusion.

  • reply
  • like
Show more messages