Running locally takes a long time/ pulling data as well

Hello guys,

for some reason, it is currently taking a long time to start my local environment. Also, my blog articles are taking a long time to load
(around 9-11 seconds or even more).

This wasn’t the case before. Are there currently problems with prismic servers?

Hey Riccardo, thanks for reaching out!

Do you have any more details that you can share with us?

NextJS projects can run in different ways when in development mode. Are you using a custom server.js file?

As for Prismic, we have a Status page available where you can look for changes at any given time.

Hello Paulina,

const express = require("express");

const next = require(“next”);
const path = require(“path”);
const bodyParser = require(“body-parser”);
const keys = require("./server/config/keys");

const dev = process.env.NODE_ENV !== “production”;

const app = next({ dir: “.”, dev });
const handle = app.getRequestHandler();

app.prepare().then(() => {
const server = express();
// Static files
// https://github.com/zeit/next.js/tree/4.2.3#user-content-static-file-serving-eg-images
server.use(
“/images”,
express.static(path.join(__dirname, “images”), {
maxAge: dev ? “0” : “365d”,
})
);

server.use(bodyParser.json());

server.get("*", (req, res) => {
return handle(req, res);
});

const PORT = process.env.PORT || 3000;

server.listen(PORT, (err) => {
if (err) throw err;
console.log(> Read on http://localhost:${PORT});
});
});

I just installed a fresh nextjs project without custom server and prismic content is still loading for a really long time

Hey @rickk

We don’t see any strange response time on our side for your repo, do you have any logs showing that. The biggest request that i had for your repo is under 200ms.

I looked on google for problem similar to yours and found this issue in nextjs and found this issue

vercel/next.js#2208

and this comment that seems to address it

vercel/next.js#2208 (comment)

It looks like an implementation issue in your Link component. Can you check please ?

Thanks,
Renaud.

1 Like

Hey Renaud,

I already checked that and I have the correct as props in my Link component

I actually found out the problem. In production the pages load super fast. Its just dev mode that the pages are really slow in loading. Any way to fix this?

Hey Rick, the link that Renaud sent us is correct, this issue is related to it. I just tested your project again and found the error on the Link. The name of the file in the href was incorrect.

So in pages/posts.js line 27 you have:

<Link href="posts/[id]" as={`/posts/${post.uid}`}>

I changed it to this and the error disappeared:

<Link href="/posts/[uid]" as={`/posts/${post.uid}`}>

Could you try this and tell us what you see?

Thanks

This issue has been closed due to inactivity.