unfolding-io / Astrorante

AstroRante is a state-of-the-art website theme crafted for fine dining establishments. Combining the power of Astro, Storyblok CMS, Vue, and Tailwind, AstroRante delivers an unparalleled online presence for your restaurant.
https://astrorante.unfolding.io/
Other
22 stars 11 forks source link

trouble syncing #1

Open hamoudydev opened 3 weeks ago

hamoudydev commented 3 weeks ago

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"

preetamslot commented 3 weeks ago

Hi, Sorry for the late reply.

Have you added your 3 tokens to the .env? 401 is a permission error.

STORYBLOK_PREVIEW_TOKEN=XXX
STORYBLOK_PERSONAL_TOKEN=XXX
STORYBLOK_SPACE_ID=000

https://astrorante.unfolding.io/news/getting-started/

if so, please share the complete error log.

hamoudydev commented 3 weeks ago

Yes, I have those all, however I'm getting a problem for every file that has the import { example } from "astro:env/server" with the problem being "Cannot find module 'astro:env/server' or its corresponding type declarations.

As for the terminal, here is what I'm getting 14:34:41 [200] /setup 26ms Error in searchListings: { message: 'Unauthorized', status: 401, response: 'Unauthorized' } 14:34:42 [400] /api/setup/datasources/pull 240ms Error in searchListings: { message: 'Unauthorized', status: 401, response: 'Unauthorized' } 14:34:52 [400] POST /api/setup/datasources/delete 326ms Error in searchListings: { message: 'Unauthorized', status: 401, response: 'Unauthorized' } 14:34:52 [400] /api/setup/datasources/pull 306ms Error in searchListings: { message: 'Unauthorized', status: 401, response: 'Unauthorized' } 14:34:55 [400] POST /api/setup/datasources/push 147ms

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.

preetamslot commented 2 weeks ago

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 STORYBLOK_PERSONAL_TOKEN So it seems that your token does not have the right privileges :(

Can you try generating a new token? https://app.storyblok.com/#/me/account?tab=token

hamoudydev commented 2 weeks ago

Just tried and same error.

preetamslot commented 2 weeks ago

I think it is related to: https://github.com/withastro/astro/issues/11816 https://github.com/withastro/astro/issues/11380

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 astro:env instances

import { XXX } from "astro:env/server" to const XXX = import.meta.env.XXX

image

hamoudydev commented 2 weeks ago

What node version are you running?

v20.15.1

can you run npx astro check and let me know if you get errors?

Zero errors

With the updated files I get a different kind of terminal error

14:26:29 [200] /setup 92ms Error in searchListings: { message: 'Not Found', status: 404, response: 'This record could not be found' } 14:26:30 [200] /api/setup/datasources/pull 300ms Error in searchListings: { message: 'Not Found', status: 404, response: 'This record could not be found' } 14:26:36 [200] /api/setup/datasources/pull 315ms

When I changed the astro:env instances I got all kinds of errors: 14:43:02 [ERROR] Unterminated string literal Stack trace: at C:/Users/Sone/Desktop/Astrorante-master/src/layouts/LayoutMinimal.astro:31:8 [...] See full stack trace in the browser, or rerun with --verbose. 14:43:02 [ERROR] Unterminated string literal Stack trace: at C:/Users/Sone/Desktop/Astrorante-master/src/layouts/LayoutMinimal.astro:31:8 [...] See full stack trace in the browser, or rerun with --verbose. 14:43:02 [astro-icon] Loaded icons from src/icons 14:43:37 [watch] src/layouts/LayoutMinimal.astro 14:43:38 [WARN] [vite] A PostCSS plugin did not pass thefromoption topostcss.parse. This may cause imported assets to be incorrectly transformed. If you've recently added a PostCSS plugin that raised this warning, please contact the package author to fix the issue. 14:43:38 [ERROR] Unterminated string literal Stack trace: at failureErrorWithLog (C:\Users\Sone\Desktop\Astrorante-master\node_modules\vite\node_modules\esbuild\lib\main.js:1472:15) [...] See full stack trace in the browser, or rerun with --verbose. 14:43:45 [watch] src/layouts/LayoutMinimal.astro 14:43:45 [ERROR] Unterminated string literal Stack trace: at failureErrorWithLog (C:\Users\Sone\Desktop\Astrorante-master\node_modules\vite\node_modules\esbuild\lib\main.js:1472:15) [...] See full stack trace in the browser, or rerun with --verbose. 14:47:15 [watch] src/pages/cms/index.astro 14:47:15 [ERROR] Unterminated string literal Stack trace: at failureErrorWithLog (C:\Users\Sone\Desktop\Astrorante-master\node_modules\vite\node_modules\esbuild\lib\main.js:1472:15) [...] See full stack trace in the browser, or rerun with --verbose. 14:47:26 [watch] src/util/translate.ts 14:47:26 [ERROR] Unterminated string literal Stack trace: at failureErrorWithLog (C:\Users\Sone\Desktop\Astrorante-master\node_modules\vite\node_modules\esbuild\lib\main.js:1472:15) [...] See full stack trace in the browser, or rerun with --verbose. 14:47:31 [watch] src/pages/api/contact/mailgun.ts 14:47:32 [ERROR] Unterminated string literal Stack trace: at failureErrorWithLog (C:\Users\Sone\Desktop\Astrorante-master\node_modules\vite\node_modules\esbuild\lib\main.js:1472:15) [...] See full stack trace in the browser, or rerun with --verbose. 14:47:34 [watch] src/pages/[...lang]/news/[...page].astro 14:47:35 [ERROR] Unterminated string literal Stack trace: at failureErrorWithLog (C:\Users\Sone\Desktop\Astrorante-master\node_modules\vite\node_modules\esbuild\lib\main.js:1472:15) [...] See full stack trace in the browser, or rerun with --verbose. 14:47:40 [watch] src/pages/[...lang]/[...slug].astro 14:47:40 [ERROR] Unterminated string literal Stack trace: at failureErrorWithLog (C:\Users\Sone\Desktop\Astrorante-master\node_modules\vite\node_modules\esbuild\lib\main.js:1472:15) [...] See full stack trace in the browser, or rerun with --verbose. 14:47:44 Configuration file updated. Restarting... 14:47:44 [WARN] [config] The adapter @astrojs/vercel/serverless provides experimental support for "astro:env getSecret". You may experience issues or breaking changes until this feature is fully supported by the adapter. 14:47:44 [types] Generated 3ms 14:47:45 [ERROR] Unterminated string literal Stack trace: at failureErrorWithLog (C:\Users\Sone\Desktop\Astrorante-master\node_modules\vite\node_modules\esbuild\lib\main.js:1472:15) [...] See full stack trace in the browser, or rerun with --verbose. 14:47:45 [astro-icon] Loaded icons from src/icons 14:47:48 [watch] src/layouts/LayoutMinimal.astro 14:47:48 [WARN] [vite] A PostCSS plugin did not pass thefromoption topostcss.parse. This may cause imported assets to be incorrectly transformed. If you've recently added a PostCSS plugin that raised this warning, please contact the package author to fix the issue. 14:47:49 [ERROR] Unterminated string literal Stack trace: at failureErrorWithLog (C:\Users\Sone\Desktop\Astrorante-master\node_modules\vite\node_modules\esbuild\lib\main.js:1472:15) [...] See full stack trace in the browser, or rerun with --verbose. 14:47:51 [watch] src/layouts/Layout.astro 14:47:52 [ERROR] Unterminated string literal Stack trace: at failureErrorWithLog (C:\Users\Sone\Desktop\Astrorante-master\node_modules\vite\node_modules\esbuild\lib\main.js:1472:15) [...] See full stack trace in the browser, or rerun with --verbose. 14:47:54 [watch] src/components/navigation/Link.astro 14:47:56 [ERROR] Unterminated string literal

preetamslot commented 2 weeks ago

This is strange!

Can you share your .env (hello@unfolding.io) then I can see what happens on my computer.

preetamslot commented 2 weeks ago

I don't know for sure, but your space ID has 7 chars, if I look at all my spaces have 6 chars. Where do you get your space id? The error is that storyblok cant find data on the space.

{
  message: 'Not Found',
  status: 404,
  response: 'This record could not be found'
}
hamoudydev commented 2 weeks ago

Settings, space, space ID.

preetamslot commented 2 weeks ago

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. When you accept the invite I will remove myself from the space.

Let me know if it works out for you!

preetamslot commented 1 day ago

@hamoudydev It looks like SB API has a lower rate limit on newer accounts, I have made some updates to the code. If it fails hit the round refresh button and try the sync again.

Even with errors I saw some data being imported.