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

🐛 BUG: create-cloudflare@2.37.0, Output the wrangler.json config format when running create-cloudflare. But when generating the next template, the wrangler.toml file will be read. #7770

Open
ruizer opened this issue Jan 15, 2025 · 3 comments · May be fixed by #7774
Assignees
Labels
bug Something that isn't working regression Break in existing functionality as a result of a recent change

Comments

@ruizer
Copy link

ruizer commented Jan 15, 2025

Which Cloudflare product(s) does this pertain to?

C3 (npm create cloudflare)

What versions are you using?

2.37.0[create-cloudflare]

What operating system and version are you using?

Mac Sonoma 14.1.1

Please provide a link to a minimal reproduction

No response

Describe the Bug

Version: create-cloudflare@2.37.0.
Output the wrangler.json config format when running create-cloudflare, but when generating the next template, the wrangler.toml file will be read.
https://github.com/cloudflare/workers-sdk/blob/main/packages/create-cloudflare/templates/next/c3.ts
`
const generate = async (ctx: C3Context) => {
const projectName = ctx.project.name;

await runFrameworkGenerator(ctx, [projectName]);

const wranglerToml = readFile(join(getTemplatePath(ctx), "wrangler.toml"));

// Note: here we add `# KV Example:` to the toml file for the KV example, we don't actually
//       include the comment in the template wrangler.toml file just so to keep it identical
//       and consistent with that of all the other frameworks
//       (instead of making it a special case which needs extra care)
const newTomlContent = wranglerToml.replace(
	/#\s+\[\[kv_namespaces\]\]\n#\s+binding\s+=\s+"MY_KV_NAMESPACE"\n#\s+id\s+=\s+"[a-zA-Z0-9]+?"/,
	($1) => `# KV Example:\n${$1}`,
);

if (!/# KV Example/.test(newTomlContent)) {
	// This should never happen to users, it is a check mostly so that
	// if the toml file is changed in a way that breaks the "KV Example" addition
	// the C3 Next.js e2e runs will fail with this
	throw new Error("Failed to properly generate the wrangler.toml file");
}

writeFile(join(ctx.project.path, "wrangler.toml"), newTomlContent);

updateStatus("Created wrangler.toml file");

};

`

Please provide any relevant error logs

╰ ERROR Error: Error: ENOENT: no such file or directory, open '/Users/user/.npm/_npx/971abe9c5e1ca794/node_modules/create-cloudflare/templates/next/wrangler.toml'

@ruizer ruizer added the bug Something that isn't working label Jan 15, 2025
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Jan 15, 2025
@ChurchTao
Copy link

+1

@tikot
Copy link

tikot commented Jan 15, 2025

regression due to #7676

@emily-shen emily-shen added the regression Break in existing functionality as a result of a recent change label Jan 15, 2025
@CarmenPopoviciu
Copy link
Contributor

hi folks,

Thank you for reporting this issue. I can indeed confirm this is a regression introduced by #7676. Working on a fix as we speak

@CarmenPopoviciu CarmenPopoviciu self-assigned this Jan 15, 2025
@CarmenPopoviciu CarmenPopoviciu moved this from Untriaged to In Progress in workers-sdk Jan 15, 2025
CarmenPopoviciu added a commit that referenced this issue Jan 15, 2025
[#7676](#7676)
switched C3 templates to default to `wrangler.json` instead
of `wrangler.toml`. Unfortunately, this unintendedly broke
the `next` template, which was still attempting to read
`wrangler.toml` specifically.

This commit fixes the regression.

Fixes #7770
CarmenPopoviciu added a commit that referenced this issue Jan 15, 2025
[#7676](#7676)
switched C3 templates to default to `wrangler.json` instead
of `wrangler.toml`. Unfortunately, this unintendedly broke
the `next` template, which was still attempting to read
`wrangler.toml` specifically.

This commit fixes the regression.

Fixes #7770
CarmenPopoviciu added a commit that referenced this issue Jan 15, 2025
[#7676](#7676)
switched C3 templates to default to `wrangler.json` instead
of `wrangler.toml`. Unfortunately, this unintendedly broke
the `next` template, which was still attempting to read
`wrangler.toml` specifically.

This commit fixes the regression.

Fixes #7770
CarmenPopoviciu added a commit that referenced this issue Jan 15, 2025
[#7676](#7676)
switched C3 templates to default to `wrangler.json` instead
of `wrangler.toml`. Unfortunately, this unintendedly broke
the `next` template, which was still attempting to read
`wrangler.toml` specifically.

This commit fixes the regression.

Fixes #7770
CarmenPopoviciu added a commit that referenced this issue Jan 15, 2025
[#7676](#7676)
switched C3 templates to default to `wrangler.json` instead
of `wrangler.toml`. Unfortunately, this unintendedly broke
the `next` template, which was still attempting to read
`wrangler.toml` specifically.

This commit fixes the regression.

Fixes #7770
CarmenPopoviciu added a commit that referenced this issue Jan 15, 2025
[#7676](#7676)
switched C3 templates to default to `wrangler.json` instead
of `wrangler.toml`. Unfortunately, this unintendedly broke
the `next` template, which was still attempting to read
`wrangler.toml` specifically.

This commit fixes the regression.

Fixes #7770
CarmenPopoviciu added a commit that referenced this issue Jan 15, 2025
[#7676](#7676)
switched C3 templates to default to `wrangler.json` instead
of `wrangler.toml`. Unfortunately, this unintendedly broke
the `next` template, which was still attempting to read
`wrangler.toml` specifically.

This commit fixes the regression.

Fixes #7770
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working regression Break in existing functionality as a result of a recent change
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

5 participants