0
votes

I've got a react application with Next.js that triggers a google cloud trigger to build a docker image and do some other things based on a cloudbuild.yaml file.

This application builds successfully locally, but when I'm building it on the Gcloud the logs show:

 Step #1: > Using external babel configuration
Step #1: > Location: "/app/.babelrc"
Step #1: Failed to compile.
Step #1: > Build error occurred
Step #1: Error: > Build failed because of webpack errors
Step #1: at build (/app/node_modules/next/dist/build/index.js:7:847)
Step #1: at runMicrotasks (<anonymous>)
Step #1: at processTicksAndRejections (internal/process/task_queues.js:93:5)
Step #1: npm ERR! code ELIFECYCLE
Step #1: npm ERR! errno 1
Step #1: npm ERR! xxx@0.1.0 build: `next build`
Step #1: npm ERR! Exit status 1
Step #1: npm ERR!
Step #1: npm ERR! Failed at the xxx@0.1.0 build script.
Step #1: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Step #1:
Step #1: npm ERR! A complete log of this run can be found in:
Step #1: npm ERR! /root/.npm/_logs/2019-09-13T11_23_36_719Z-debug.log
Step #1: The command '/bin/sh -c npm run build' returned a non-zero code: 1

Locally however it's a completely different story

Creating an optimized production build ...

> Using external babel configuration
> Location: "C:\Users\name\Documents\GitHub\xxx\.babelrc"
Compiled successfully.

Anyone know a good way to debug this issue?

Thanks.

1
Usually when a build is successful locally but not in Cloud Build then it's a deployment error. Could you provide your cloudbuild.yaml file? Also your logs may indicate where to look. If I were you I would start with searching about: Step #1: Error: > Build failed because of webpack errors There are a lot of [issues][1] similar to yours And of course check the complete logs as it is stated: Step #1: npm ERR! A complete log of this run can be found in: Step #1: npm ERR! /root/.npm/_logs/2019-09-13T11_23_36_719Z-debug.log [1]: github.com/zeit/now-builders/issues/168siamsot
I don't have the same error message with webpack, but mine also works well locally but not on google build. where do you find the /root/.npm/_logs folder ?GuillaumeLabs

1 Answers

1
votes

It turns out the issue was that external .Scss stylesheets were not tolerated. I removed them and instead moved the styling to within the components using tag.