Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1507

Next.js (React 18) not working with HTTPS [duplicate]

$
0
0

I'm upgraded my existing Next.js project to React 18. Everything ok in http local server but im trying to run project with ssl.

Now im getting this error

Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot

Also it works with no problem in React 17

server.js file

const { createServer } = require('https');const { parse } = require('url');const next = require('next');const fs = require('fs');const dev = process.env.NODE_ENV !== 'production';const app = next({ dev });const handle = app.getRequestHandler();const httpsOptions = {    key: fs.readFileSync('./src/certificates/localhost-key.pem'),    cert: fs.readFileSync('./src/certificates/localhost.pem')};app.prepare().then(() => {    createServer(httpsOptions, (req, res) => {        const parsedUrl = parse(req.url, true);        handle(req, res, parsedUrl);    }).listen(3000, (err) => {        if (err) throw err;        console.log('>>>>>> Server works with SSL on localhost:3000');    });});

Viewing all articles
Browse latest Browse all 1507

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>