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

Keystatic 2 astro integration fails to build with storage kind local #808

Closed
jarhodes314 opened this issue Dec 7, 2023 · 1 comment · Fixed by #810
Closed

Keystatic 2 astro integration fails to build with storage kind local #808

jarhodes314 opened this issue Dec 7, 2023 · 1 comment · Fixed by #810
Labels
bug Something isn't working

Comments

@jarhodes314
Copy link

Creating a new keystatic astro project with npm create @keystatic@latest results in the npm run build command failing.

To reproduce

  • Run npm create @keystatic@latest
  • Run npx astro add node
  • Run npm install
  • Run npm run build and observe the error message below
$ pnpm build

> @keystatic/templates-astro@0.0.14 build /path/goes/here
> astro build

17:29:01 Types generated 202ms
17:29:01 [build] output: "hybrid"
17:29:01 [build] directory: /path/goes/here/dist/
17:29:01 [build] adapter: @astrojs/node
17:29:01 [build] Collecting build info...
17:29:01 [build] ✓ Completed in 223ms.
17:29:01 [build] Building hybrid entrypoints...
17:29:02 [ERROR] [vite] [commonjs--resolver] Expected ';', '}' or <eof> in .../node_modules/.pnpm/@keystatic+astro@2.0.2_@keystatic+core@0.2.6_astro@4.0.3_react-dom@18.2.0_react@18.2.0/node_modules/@keystatic/astro/api/dist/keystatic-astro-api.esm.js
file: .../node_modules/.pnpm/@keystatic+astro@2.0.2_@keystatic+core@0.2.6_astro@4.0.3_react-dom@18.2.0_react@18.2.0/node_modules/@keystatic/astro/api/dist/keystatic-astro-api.esm.js:7:135
5:   const handler = makeGenericAPIRouteHandler({
6:     ..._config,
7:     secret: (_config$secret = _config.secret) !== null && _config$secret !== void 0 ? _config$secret : tryOrUndefined(() => {"BASE_URL": "/", "MO...
                                                                                                                                          ^
8:   }, {
9:     slugEnvName: "PUBLIC_KEYSTATIC_GITHUB_APP_SLUG"

Deleting lines that set clientId, clientSecret & secret from the file quoted in the error message and rebuilding works, so this appears to be an issue that appears when the storage kind is set to local. I didn't attempt to configure github integration to see if that also mitigates the issue.

Excerpt of package json showing the dependency versions installed for me when I produced the error. All of the version numbers are fully up-to-date at the time of writing, despite the ^ version specifier.

{
 "dependencies": {
    "@astrojs/markdoc": "^0.8.0",
    "@astrojs/node": "^7.0.0",
    "@astrojs/react": "^3.0.7",
    "@keystatic/astro": "^2.0.2",
    "@keystatic/core": "^0.2.6",
    "@types/react": "^18.2.42",
    "@types/react-dom": "^18.2.17",
    "astro": "^4.0.3",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  }
}
@simonswiss simonswiss added the bug Something isn't working label Dec 8, 2023
@simonswiss
Copy link
Collaborator

I was able to reproduce — we'll look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants