-
Notifications
You must be signed in to change notification settings - Fork 11
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
trouble syncing #1
Comments
Hi, Sorry for the late reply. Have you added your 3 tokens to the .env?
https://astrorante.unfolding.io/news/getting-started/ if so, please share the complete error log. |
Yes, I have those all, however I'm getting a problem for every file that has the As for the terminal, here is what I'm getting Oddly enough after a few refreshes it started working but couldn't sync everything, when I created a new space and updated the .env it no longer works again spitting out the same errors. |
The error on Pull is a Storyblok API error. export const pullComponents = async () => {
const components = await Storyblok.get(
`/spaces/${STORYBLOK_SPACE_ID}/components/`,
{},
);
return components?.data?.components;
}; This is uses an auth with your Can you try generating a new token? |
Just tried and same error. |
I think it is related to: So it looks like on your machine "astro:env/server" is not working,
I have upgraded all packages, maybe it is already fixed in the latest astro. If this does not work you could convert all
|
Zero errors With the updated files I get a different kind of terminal error
When I changed the |
This is strange! Can you share your .env (hello@unfolding.io) then I can see what happens on my computer. |
I don't know for sure, but your space ID has 7 chars, if I look at all my spaces have 6 chars.
|
Settings, space, space ID. |
I have created a space for you on my partner account and imported everything, not clear to me why it was not working for you. Let me know if it works out for you! |
@hamoudydev Even with errors I saw some data being imported. |
I noticed that, however when using my own API I'm still getting that 404 issue. |
Same here, I can't sync 02:01:11 [200] /api/setup/datasources/pull 303ms
ERROR::: {
message: 'Not Found',
status: 404,
response: 'This record could not be found'
} |
@NightmareVCO This message is on pull, so this means that you don't have data sources. Let me know. |
do we have to manually enter the data into storyblok? |
That would be a lot of work :( The error looks like Storyblok Api cant find the data. Can you debug if the api gets your .env vars? so in export const pullDataSources = async () => {
try {
console.log("STORYBLOK_SPACE_ID:", STORYBLOK_SPACE_ID); // check space id
console.log("STORYBLOK_PERSONAL_TOKEN:", token); // check token
console.log("Storyblok SDK", Storyblok); // check SDK connection
const dataSources = await Storyblok.get(
`/spaces/${STORYBLOK_SPACE_ID}/datasources/`,
{},
);
...
}
while testing I get this error when I enter a wrong
And this error when I enter a wrong
|
To see that your current space id is, please add this code to import { api } from "@util/storyblokApi";
const { data } = (await api.get("cdn/spaces/me", {})) as SpaceObj;
console.log("CURRENT SPACE DATA:", data); |
@preetamslot In my case; when I run the code with export const pullDataSources = async () => {
try {
console.log("STORYBLOK_SPACE_ID:", STORYBLOK_SPACE_ID); // check space id
console.log("STORYBLOK_PERSONAL_TOKEN:", token); // check token
console.log("Storyblok SDK", Storyblok); // check SDK connection
const dataSources = await Storyblok.get(
`/spaces/${STORYBLOK_SPACE_ID}/datasources/`,
{},
);
...
} the output is the same data that I have in my .env file and the client:
But then when I added this code: import { api } from "@util/storyblokApi";
const { data } = (await api.get("cdn/spaces/me", {})) as SpaceObj;
console.log("CURRENT SPACE DATA:", data); the output is:
the error comes from: export const getSettings = async (lang?: string | undefined) => {
try {
const { data: settingsData } = (await api.get(
"cdn/stories/site-settings/settings",
{
version: import.meta.env.DEV ? "draft" : "published",
language: !lang ? "default" : lang,
},
)) as ISbResult;
return settingsData?.story?.content as SettingsStoryblok;
} catch (error) {
console.log("Fetch Settings error:", error);
throw new Error("Can't fetch settings, is it published?");
^
}
}; here you have a screenshot |
just saved me a whole bunch of copy/paste lol but mine was the exact same thing. |
I see you get an
to the setup route. This is good news! and means that your space preview token is not is loaded correct in the astro.config integrations: [
storyblok({
accessToken: env.STORYBLOK_PREVIEW_TOKEN,
....
can you console.log the A quick fix would be to just hardcode your Let me know if this helps |
So I added in console.log({env}); Result: Even though I added the There's no change at all. Same error: 11:57:20 [ERROR] {"message":"Unauthorized","status":401,"response":"Unauthorized"} But now the error comes from: |
Then your STORYBLOK_PREVIEW_TOKEN is not working, can you generate a new one for your space? |
@preetamslot So I did that: and back to: and: Fetch Settings error: { message: 'Unauthorized', status: 401, response: 'Unauthorized' }
13:01:04 [ERROR] Can't fetch settings, is it published? |
Well I finally resolved the problem. Probably @hamoudydev did the same as I did, I chose US server, that's why our spaces ID have 7 chars. I created a new space at EU server, that generated me a 6 chars space ID and works perfect. I guess it would be necessary to say that in docs or find a solution. |
can confirm that EU server 6 digit space ID works. |
That is indeed a setting in the astro.config.
more info here: |
this is my first time working with storyblok so maybe i'm an idiot but i followed the instructions but can't get anything to sync. just getting a 401 error from "errors/utils.js:64:19"
The text was updated successfully, but these errors were encountered: