Skip to content

Bundling issue with better-auth & generated website name includes uppercase characters #1251

@manh21

Description

@manh21

This issues is related to issues #1135

Error Logs:

Error: Processing .alchemy\local\wrangler.jsonc configuration:
  - Expected "name" to be of type string, alphanumeric and lowercase with dashes only but got "pemira-web-Naufal".
    at readConfig (D:\Project\senusa\pemira\node_modules\.bun\[email protected]+4bfeec8b99b925c3\node_modules\wrangler\wrangler-dist\cli.js:50147:11)
    at readWorkerConfig (file:///D:/Project/senusa/pemira/node_modules/.bun/@[email protected]+61472716f6a2e1cb/node_modules/@cloudflare/vite-plugin/dist/index.mjs:6807:17)
    at readWorkerConfigFromFile (file:///D:/Project/senusa/pemira/node_modules/.bun/@[email protected]+61472716f6a2e1cb/node_modules/@cloudflare/vite-plugin/dist/index.mjs:6877:17)
    at resolveWorkerConfig (file:///D:/Project/senusa/pemira/node_modules/.bun/@[email protected]+61472716f6a2e1cb/node_modules/@cloudflare/vite-plugin/dist/index.mjs:6994:64)
    at resolvePluginConfig (file:///D:/Project/senusa/pemira/node_modules/.bun/@[email protected]+61472716f6a2e1cb/node_modules/@cloudflare/vite-plugin/dist/index.mjs:7031:36)
    at BasicMinimalPluginContext.config (file:///D:/Project/senusa/pemira/node_modules/.bun/@[email protected]+61472716f6a2e1cb/node_modules/@cloudflare/vite-plugin/dist/index.mjs:16226:33)
    at runConfigHook (file:///D:/Project/senusa/pemira/node_modules/.bun/[email protected]+64b5201138d1baf6/node_modules/vite/dist/node/chunks/config.js:35934:42)
    at async resolveConfig (file:///D:/Project/senusa/pemira/node_modules/.bun/[email protected]+64b5201138d1baf6/node_modules/vite/dist/node/chunks/config.js:35436:13)
    at async _createServer (file:///D:/Project/senusa/pemira/node_modules/.bun/[email protected]+64b5201138d1baf6/node_modules/vite/dist/node/chunks/config.js:25361:67)
    at async CAC.<anonymous> (file:///D:/Project/senusa/pemira/node_modules/.bun/[email protected]+64b5201138d1baf6/node_modules/vite/dist/node/cli.js:572:18)

Alchemy Version:
0.81.1

Temporary Workaround Suggested:

export const worker = TanStackStart("web", {
	name: 'web-pemira-naufal'
});

cause worker error:

[creating]  web Creating Resource...
[creating]  web > url Creating Resource...
[created]   web > url Created Resource
[created]   web Created Resource
[creating]  server Creating Resource...
service core:user:pemira-server-naufal: Uncaught TypeError: The argument 'path' The argument must be a file URL object, a file URL string, or an absolute path string.. Received 'undefined'
  at node:module:34:15 in createRequire
  at .alchemy/out/pemira-server-naufal/index.js:23131:33
ERROR Scope failed pemira/Naufal/server
WARN Scope is in error, skipping finalize
ERROR Scope failed pemira/Naufal
62433 |       this.#workerOpts.flatMap((w2) => w2.core.name ?? []),
62434 |       this.#disposeController.signal
62435 |     );
62436 |     if (this.#disposeController.signal.aborted) return;
62437 |     if (maybeSocketPorts === void 0) {
62438 |       throw new MiniflareCoreError(
                        ^
MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
 cause: undefined,
  code: "ERR_RUNTIME_FAILURE"

      at #assembleAndUpdateConfig (D:\Project\senusa\pemira\node_modules\.bun\[email protected]\node_modules\miniflare\dist\src\index.js:62438:17)
      at processTicksAndRejections (native:7:39)

Full Alchemy Code

import alchemy from "alchemy";
import { TanStackStart } from "alchemy/cloudflare";
import { Worker } from "alchemy/cloudflare";
import { D1Database } from "alchemy/cloudflare";
import { config } from "dotenv";

config({ path: "./.env" });
config({ path: "./apps/web/.env" });
config({ path: "./apps/server/.env" });

const app = await alchemy("pemira");

const db = await D1Database("database", {
	migrationsDir: "packages/db/src/migrations",
});

export const web = await TanStackStart("web", {
	name: "web-pemira-naufal",
	cwd: "apps/web",
	bindings: {
		VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
		DB: db,
		CORS_ORIGIN: process.env.CORS_ORIGIN || "",
		BETTER_AUTH_SECRET: alchemy.secret(process.env.BETTER_AUTH_SECRET || ""),
		BETTER_AUTH_URL: process.env.BETTER_AUTH_URL || "",
	},
	dev: {
		command: "bun run dev",
	},
});

export const server = await Worker("server", {
	cwd: "apps/server",
	entrypoint: "src/index.ts",
	compatibility: "node",
	bindings: {
		DB: db,
		CORS_ORIGIN: process.env.CORS_ORIGIN || "",
		BETTER_AUTH_SECRET: alchemy.secret(process.env.BETTER_AUTH_SECRET || ""),
		BETTER_AUTH_URL: process.env.BETTER_AUTH_URL || "",
	},
	dev: {
		port: 3000,
	},
});

console.log(`Web    -> ${web.url}`);
console.log(`Server -> ${server.url}`);

await app.finalize();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions