Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Index creation failed - after adding API URL & Key #168

Closed
robbiecren07 opened this issue Feb 14, 2022 · 10 comments
Closed

Error: Index creation failed - after adding API URL & Key #168

robbiecren07 opened this issue Feb 14, 2022 · 10 comments

Comments

@robbiecren07
Copy link

Issue:
Capture

Steps I took:
I cloned the git repo, yarn install > yarn run dev - successfully opened localhost:300.
After that I signed up for a free trail of Ghost Pro, then I created a custom integration within Ghost Admin to generate a key. Then I changed the CMS_GHOST_API_URL & CMS_GHOST_API_KEY on lines 5-6 in /lib/processEnv.ts - to the new key and URL which I generated. I saved the file and did yarn run dev, once I opened localhost:300, I was given the error.

Here is the console error as well:
Capture

After the error, I also tried creating a .env.local file in the root with my CMS_GHOST_API_URL & CMS_GHOST_API_KEY.

@styxlab
Copy link
Owner

styxlab commented Feb 14, 2022

Welcome @robbiecren07! Can you publish your API URL and keys here (you can invalidate them after a day), so I have a chance to debug the issue on my end?

BTW, do you have any published content on your site?

@robbiecren07
Copy link
Author

Sure!
https://l2-code.ghost.io
00704d0b67c452250f5086d7d7

@styxlab
Copy link
Owner

styxlab commented Feb 14, 2022

Thanks! I can reproduce the issue with your credentials. I don't know the exact reason yet, but a workaround is to deactivate the file cache in `appConfig.ts':

// Cache control
export const fileCache: boolean = false

Can you please test if that could be a (temporary) workaround?

@styxlab
Copy link
Owner

styxlab commented Feb 14, 2022

Just noticed that error I am getting is different from yours:
image
So, not sure if we are talking about the same issue.

@styxlab
Copy link
Owner

styxlab commented Feb 14, 2022

The error I am getting has been reported here: vercel/next.js#33860 and needs to be fixed upstream. Another workaround is to downgrade next.js to version 12.0.9. I'll update this package once the upstream fix is available.

@styxlab
Copy link
Owner

styxlab commented Feb 14, 2022

@robbiecren07: I am still puzzled how you got the "Index creation failed" error. I cannot reproduce it.

@robbiecren07
Copy link
Author

@styxlab Sorry for the delayed reply, when I get online later tonight I will try the cache control and downgrade nextjs and see how that works.

As for the index error, I may have done something while I was trying to fix it. So maybe I'll do a clean git clone again and make sure I don't audit fix anything and just enter my API key and URL and see if I still get the index error. I'll report back later tonight.

@robbiecren07
Copy link
Author

Ok I think I figured it out, which it's a big error on my end. I tried the cache control and downgrade on nextjs and that didn't work. So I created a new clone and only did npm install and switched out the API key and URL in processEnv.ts - I ran npm run dev and it opened successfully.

So I went back into my first repo, I realized I still had the .env.local which I created after trying to troubleshot, so I deleted that file and npm run dev worked. I think what happen was when I first changed out the API keys & URL, for the URL I left the forward slash at the end of URL. which is what caused the first error, then while trying to debug it I created the .env.local file, which just through the same error.

So in the end, no need to downgrade nextjs, or disable the cache control. Just needed to delete the .env.local and make sure to type the correct URL without the trailing forward slash in the processEnv.ts file.

@styxlab
Copy link
Owner

styxlab commented Feb 15, 2022

I am glad you got it working! Just note that for local development, you should add the keys to '.env.local' and not change any files.

BTW, if you don't give custom keys, there is an automatic fallback to a test system that I am hosting.

@nring
Copy link
Contributor

nring commented Feb 17, 2022

I hit the same issue. It turned out to be a featured image URL that 404'd, nor did I have it set up as a permitted <Image> host.

@styxlab styxlab closed this as completed Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants