question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with tpl.js files that are copied over, running through prettier and failing on Heroku

See original GitHub issue

Bug Report

Describe the bug

npx docz build fails on heroku, it works perfectly on our OSX machines.

It looks to me like the template files that are generated are breaking as they’re generated:

import React from 'react'
import { hot } from 'react-hot-loader'
import Theme from 'docz-theme-default'
import { imports } from './imports' import db from './db.json' 
const Root = () => (
  <theme db="{db}" imports="{imports}" hashrouter="{" false }   >
)
export default hot(module)(Root)

Once the broken files are copied over, prettier is failing to parse them.

screen shot 2018-10-09 at 15 10 28
✖  fatal     SyntaxError: Unexpected token, expected ";" (1:27)
> 1 | import React from 'react' import { hot } from 'react-hot-loader' import Theme from 'docz-theme-default' import { imports } from './imports' import db from './db.json'  const Root = () => (<theme db="{db}" imports="{imports}" hashrouter="{" false }   >) export default hot(module)(Root)
    |                           ^
    at t (/app/node_modules/docz-utils/node_modules/prettier/parser-babylon.js:1:326)
    at Object.d [as parse] (/app/node_modules/docz-utils/node_modules/prettier/parser-babylon.js:1:187968)
    at Object.parse$2 [as parse] (/app/node_modules/docz-utils/node_modules/prettier/index.js:7138:19)
    at coreFormat (/app/node_modules/docz-utils/node_modules/prettier/index.js:10398:23)
    at format (/app/node_modules/docz-utils/node_modules/prettier/index.js:10570:16)
    at formatWithCursor (/app/node_modules/docz-utils/node_modules/prettier/index.js:10582:12)
    at /app/node_modules/docz-utils/node_modules/prettier/index.js:34924:15
    at Object.format (/app/node_modules/docz-utils/node_modules/prettier/index.js:34943:12)
    at Promise (/app/node_modules/docz-utils/lib/index.js:1:4327)
    at new Promise (<anonymous>)
    at Object.format (/app/node_modules/docz-utils/lib/index.js:1:4292)
    at Promise (/app/node_modules/docz-core/dist/index.js:1:87660)
    at new Promise (<anonymous>)
    at touch (/app/node_modules/docz-core/dist/index.js:1:87581)
    at writeAppFiles (/app/node_modules/docz-core/dist/index.js:1:91416)
    at <anonymous>

I’ve created a repository with the failing build step if you deploy on Heroku here: https://github.com/shortlist-digital/tapestry-lite-docz

(I’ve since removed our internal library tapestry-lite from the heroku app, and docz build still fails.

Additional context/Screenshots Add any other context about the problem here. If applicable, add screenshots to help explain.

This is really strange, and only occurs on Heroku containers.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
jedrichardscommented, Oct 23, 2018

I get the exact same error when building on Netlify. I think I’ve tracked it down to when a NODE_ENV=production env var is present. In fact this fails the build locally too, as well as in Heroku/Netlify containers:

NODE_ENV=production yarn build:docz
✖  fatal     SyntaxError: Unexpected token, expected ";" (1:27)

Feels like a bug somewhere? Setting NODE_ENV to production is common practice when building on services like Heroku.

2reactions
jonsherrardcommented, Nov 6, 2018

Docz authors, thank you for the fantastic tool and all the work you’ve done on it.

I can’t believe it’s free!

When I find some time I’ll try and contribute a fix as a way of saying thanks.

@bingo4508 might even help too

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Node.js Deploys - Heroku Dev Center
Your Node.js deploy failed - now what? Start with these simple steps to troubleshoot a build issue. Check the buildpack. Is the app...
Read more >
Cannot find file on trying to deploy to heroku (works locally)
Failed to compile. ./src/routes.js // my beautiful error here Cannot find file './Components/User/signup/signup.js' in '.
Read more >
Deploying your Dash App to Heroku — THE MAGICAL GUIDE
The local HTTP server (shipped with your Python installation) is automatically run by your Python Kernel when your dash app is executed on...
Read more >
Fix all errors with Heroku deploying failure - YouTube
When you deploy failed a simple app to Heroku, you may encounter various types of error. This video is a guide to fix...
Read more >
Heroku deploy failure - Top 3 error newbies always have
When you deploy failed a simple app to Heroku, you may encounter various types of error. This video is a guide to fix...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found