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

Upgrading to 0.9.0 is throwing an error #171

Closed
jasikpark opened this issue Nov 11, 2024 · 8 comments
Closed

Upgrading to 0.9.0 is throwing an error #171

jasikpark opened this issue Nov 11, 2024 · 8 comments

Comments

@jasikpark
Copy link
Contributor

Cannot read properties of undefined (reading 'object')
  Stack trace:
    at file:///Users/calebjasik/Git/jasik-2.0/.netlify/build/chunks/post_C9dswsZq.mjs:13678:7
    at ModuleJob.run (node:internal/modules/esm/module_job:268:25)
    at async render (file:///Users/calebjasik/Git/jasik-2.0/.netlify/build/chunks/site-config-vars_BmO8zSp5.mjs:611:28)
    at async callComponentAsTemplateResultOrResponse (file:///Users/calebjasik/Git/jasik-2.0/node_modules/.pnpm/astro@4.16.10_@types+node@22.9.0_lightningcss@1.28.1_rollup@4.21.2_typescript@5.6.3/node_modules/astro/dist/runtime/server/render/astro/render.js:90:25)
    at async renderPage (file:///Users/calebjasik/Git/jasik-2.0/node_modules/.pnpm/astro@4.16.10_@types+node@22.9.0_lightningcss@1.28.1_rollup@4.21.2_typescript@5.6.3/node_modules/astro/dist/runtime/server/render/page.js:31:24)
 ELIFECYCLE  Command failed with exit code 1.

Upgrading to 0.9.0 for bluesky post support is throwing an error on build. Strangely not when in dev mode though. At first I thought it was b/c I hadn't enabled content layers, but that didn't seem to fix anything.

@delucis
Copy link
Owner

delucis commented Nov 11, 2024

Hmm. Any chance you can share a reproduction?

@jasikpark
Copy link
Contributor Author

Not too minimal, but here you go: https://github.com/jasikpark/astro-embed-repro-171

@delucis
Copy link
Owner

delucis commented Nov 12, 2024

Ok, so this is weird, but are you using zod directly anywhere in the real code base? The error above (reading 'object') looks to be an issue in JS using z.object({}) where Zod is bundled incorrectly leading to z being undefined. Not sure exactly why, but uninstalling the direct Zod dependency (which is not used in your repro) made builds work again.

If you are using Zod yourself directly, you could try replacing those imports to use Astro’s re-export from the astro/zod module.

@jasikpark
Copy link
Contributor Author

I was using it in Layout.astro, but replacing the imports like you said works. This is very strange, but honestly I'm not motivated to discover why things are broken. Thanks for helping me figure it out!

@JeroenReumkens
Copy link

I just ran into the same error after days of trying to find where this error was coming from. Eventually nailed it down to this package too.

I fixed it by changing my import to @astro-community/astro-embed-twitter.

Not sure if this is helpful at all to you, but I thought it would at least be good to know that there's multiple occurrences of this issue, and that it's very hard to track down 😅

@delucis
Copy link
Owner

delucis commented Nov 25, 2024

Thanks for sharing! Did you also by any chance have Zod as a package dependency?

@JeroenReumkens
Copy link

Sorry, forgot to mention this. Yes I did! Was using it in one occurrence, but nothing related to the tweet package.

@delucis
Copy link
Owner

delucis commented Nov 25, 2024

Thanks! Super weird. We’re not actually using Zod directly in this library, but it is a dependency of the @atproto libraries the Bluesky component uses. Bit of a mystery to me exactly what’s going on, but I guess for some reason the different Zod deps are getting confused leading to some bundling error.

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