Comments (6)
I'm on Windows and had issues with this as well, but I fixed it by using the cross-env package. I changed the serve script in package.json to "cross-env NODE_ENV=production firebase serve --only functions,hosting"
, and I changed build-app to "cross-env NODE_ENV=production next build \"src/app\""
. Now I don't get any issues with build, serve or deploy
edit: It seems that the code I deploy doesn't actually work, probably because the Next compiler is writing some file paths with \ separators instead of /, which is not supported by Firebase.
from firebase-functions-next-example.
It would be interesting to see how this functions on Windows given the update to firebase-tools
and the serve
command. Could the next Windows user to come across this please let us all know? Cheers in advance!
from firebase-functions-next-example.
Was recieving the following error:
! functions[app-next(us-central1)]: Deployment error.
Function failed on loading user code. Error message: Code in file index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: Error: Could not find a valid build in the '/user_code/next' directory! Try building your app with 'next build' before starting the server.
at Server.readBuildId (/user_code/node_modules/next/dist/server/next-server.js:783:15)
at new Server (/user_code/node_modules/next/dist/server/next-server.js:80:25)
at module.exports (/user_code/node_modules/next/dist/server/next.js:6:10)
at Object.<anonymous> (/user_code/app/app.js:17:31)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
when deploying, after adding cross-env
as Hexellate suggested the deploy worked.
But still currently having issues seeing the output on the firebaseapp.
it just shows Internal Server Error
will report back
from firebase-functions-next-example.
So looking at the firebase logs, i saw this error:
{ Error: Cannot find module '/user_code/next/server/static\6kN8iFmiMafh42XoG7uzi\pages\index.js
at Function.Module._resolveFilename (module.js:476:15
at Function.Module._load (module.js:424:25
at Module.require (module.js:504:17
at require (internal/module.js:20:19
at _callee$ (/user_code/node_modules/next/dist/server/require.js:85:46
...
...
'MODULE_NOT_FOUND' }
After noticing the paths using \ I tried a find and replace on the dist folder and replaced all \ with /'s
and then disabled the predeploy
key in firebase.json
, then re-deployed:
and it worked!
will look into how to make the build output /'s instead of \'s
from firebase-functions-next-example.
looks like the issue was fixed in next 7.0.3
vercel/next.js#4920
so upgrading to 7.0.3 should fix. so if using Windows, just remember to add cross-env
as mentioned above
from firebase-functions-next-example.
Hi all, sorry for not getting back to you sooner. I am deprecating this example in favor of another approach, which can be found in this repo (https://github.com/jthegedus/firebase-gcp-examples/tree/master/functions-nextjs). Hopefully it is somewhat more windows friendly. I am back on Windows, had used WSL2 in the past but found it slow, so am now testing out the new VSCode Online - https://visualstudio.microsoft.com/services/visual-studio-online/
I've been very busy the last few months and getting back into the swing of OSS and writing so if you are having issues I will truly try and be more prompt next time. Cheers.
from firebase-functions-next-example.
Related Issues (20)
- inconsistent information HOT 3
- Get a mate with a Windows machine to test this repo
- Add SCSS/SASS import HOT 3
- how to user a custom HTML template for render HOT 4
- Integrate firebase realtime database example HOT 3
- Cache-Control HOT 2
- style jsx doesn't work on firebase but does on local dev server HOT 2
- Why the projcet dont have a <Head> component? HOT 1
- Cannot find module 'babel-runtime/regenerator' HOT 7
- Error: Cannot find module '/user_code/next/server/pages-manifest.json' HOT 6
- Anyone had any luck with firebase functions on node 8 and next 6.1 HOT 3
- @google-cloud/functions-emulator | Suggested Solution HOT 2
- Image assets HOT 3
- Working with service worker offline HOT 1
- Incorporating Firebase Auth HOT 1
- 'NODE_ENV' is not recognized as an internal or external command HOT 1
- Unexpected identifier prepare() on function deploy HOT 1
- not working on new versions of nextjs 4 and react 16 HOT 11
- Can not deploy when dev = false HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebase-functions-next-example.