Link resolver error and errors creating documents in new repositories

Hi @samlittlefair (or anyone else who can help :slightly_smiling_face:),

I'm excited to try your tutorial, SvelteKit Crash Course: Build a Full Website in 90 min! - 2023 Tutorial, but I'm hung up on an error during setup.

After the initial setup, I get a 500 error when I open the VITE (v5.0.9) URL. The error is:

[vite:dev] Declared type: page
[vite:dev] Expected one of:
[vite:dev] 
[vite:dev] [Link resolver error] Unknown type
[vite:dev] Declared type: page

It looks like someone else is currently having a similar issue, so I don't know whether we're both doing something wrong, or if something has changed that has broken the setup?

Any advice is appreciated.

Thanks.

Same here!

Hey folks,

Thanks for flagging this! I can tell you what the problem is:

When you launch the starter project, the init command pushes some schemas and boilerplate documents to your Prismic repository. The init command is failing to push the boilerplate documents.

The error that you're seeing happens when there's a route declared in the routes array for a type that doesn't exist. Your routes array is located in src/lib/prismicio.js.:

const routes = [
	{
		type: 'page',
		uid: 'home',
		path: '/'
	},
	{
		type: 'page',
		path: '/:uid'
	}
];

Your repository was created with a "page" type, but since there are no documents created, the type effectively doesn't exist in the repository. So, when the app tries to initialize the client, the client sends a query to the API with a declaration for a "page" route that doesn't exist yet, and the API throws an error.

Yeah okay but why?

We're currently doing some work to improve our API performance, and I suspect that might have interfered with the ability of the init command to push documents. I'm investigating myself, and I'm finding a similar error. I'm going to keep exploring to see if I can find a solution.

Sam

@steeleware @jacques.karsten I've updated the title to help other users find this issue.

On our side, the dev team is investigating this at the moment.

Are you able to create documents in your repositories?

@steeleware @jacques.karsten It looks like the team has solved the issue that caused repositories to break in the first place. However, I'm not sure if they'll be able to fix your repositories. You might want to restart the tutorial and create new repositories.

Thanks for looking into this @samlittlefair, this resolved the issue.

Btw, I was able to create a page in my repository but still got the same error after adding it. I deleted the repository, created a new one and now it works as expected. :slightly_smiling_face:

1 Like