menu
up-caret
down-caret

ZEIT

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

# General

General Chatter

Trending conversations
Transpiling for es6 modules and node-server?
@deitcher · 5h
503 on deployment
@codelayer · 25d
Do apps on now stay up for a long time without refreshing?
@marc-sloth-eastman · 2h
BRU1 instances are timing out
@helguita · 34d
Are Now Logs Working?
@txemaleon · 22h

deploying a mern.io app using NOW

Anandhu Manoj (@anandhu) · February 21, 2019 at 2:46pm

deploying a mern.io app using NOW

February 21, 2019 at 2:46pm

I wasted almost half of my day trying to deploy mern-starter app from HashNode. If someone has any idea regarding this please help me. Thank you


February 21, 2019 at 4:09pm
"version": 2,
"builds": [
{ "src": "package.json", "use": "@now/static-build","config":{"distDir": "dist"}},
{ "src": "index.js", "use": "@now/node","config":{"maxLambdaSize":"20mb"}}
],
"routes":[
{ "src": ".*", "dest": "dist/server.bundle.js" }
],
"env":{
"NODE_ENV":"production"
}
}
  • reply
  • like

this is my now.json file

  • reply
  • like

A few things caught my attention:

"routes":[
{ "src": ".*", "dest": "dist/server.bundle.js" }
],

That is wrong. No way your whole app is being served by that json. Check the "Output" in /_src.

{ "src": "index.js", "use": "@now/node","config":{"maxLambdaSize":"20mb"}}

Are you sure you are using the right builder? It seems the example has .listen() and you should use @now/node-server.

  • reply
  • like

Ofcourse I did try the @now/node-server builder. but the result was same . Also I cant see the "Output section" because the deployment didn't succeed.

Edited
  • reply
  • like

Can you give me the error from the logs?

  • reply
  • like

In server/server.js there are some jsx code. I think this is the cause of error

  • reply
  • like

That can be it, indeed... If you want, you can create a new issue in github.com/zeit/ncc about it

  • reply
  • like

But I think I am missing something, I want to transpile my jsx in the server and use its build output as the source for my @now/node-server builder. Is this possible ?

  • reply
  • like

I don't think that is supported. Here is the thing: We need our builders to wrap your code in a lambda. Our builders use NCC to analyze and make your code as small as possible. I think NCC is failing because it is not recognizing the JSX in your .js file.

  • reply
  • like

May be I should transpile my jsx locally and then use it instead of the source file, right?

  • reply
  • like

That can work, yes.

  • reply
  • like

ok then. I will try that out. Thanks

  • reply
  • like