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: wrangler types copies actual string from wrangler.toml instead of the type #7273

Open
shmuli9 opened this issue Nov 16, 2024 · 2 comments
Labels
bug Something that isn't working

Comments

@shmuli9
Copy link

shmuli9 commented Nov 16, 2024

Which Cloudflare product(s) does this pertain to?

Wrangler

What version(s) of the tool(s) are you using?

3.86.1 & 3.87.0 [Wrangler]

What version of Node are you using?

20.15.0

What operating system and version are you using?

Windows 11

Describe the Bug

Observed behavior

When running wrangler types the worker-configuration.d.ts is wrongly populated with the actual value in the wrangler.toml instead of setting up the types

Expected behavior

When running wrangler types the worker-configuration.d.ts is sets up the types to reflect the types of values in the wrangler.toml

Steps to reproduce

Please provide the following:

wrangler.toml

[vars]
SERVER_ADDRESS = "http://localhost:3000/event"
BUCKET_NAME ="my-bucket"
CLOUDFLARE_ACCOUNT_ID="XXXXX"
ACCESS_KEY_ID="XXXXX"

worker-configuration.d.ts

// Generated by Wrangler by running `wrangler types`

interface Env {
	SERVER_ADDRESS: "http://localhost:3000/event";
	BUCKET_NAME: "my-bucket";
	CLOUDFLARE_ACCOUNT_ID: "XXXXX";
	ACCESS_KEY_ID: "XXXXX";
	SECRET_ACCESS_KEY: string;
	BUCKET: R2Bucket;
	DB: D1Database;
	QUEUE: Queue;
}
  • Commands used to start your local dev server, including custom env and cli args
    npx wrangler types

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

@shmuli9 shmuli9 added the bug Something that isn't working label Nov 16, 2024
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Nov 16, 2024
@shmuli9
Copy link
Author

shmuli9 commented Nov 16, 2024

This seems to be related #5082

@shmuli9
Copy link
Author

shmuli9 commented Nov 16, 2024

The only way to fix this seems to be by defining the variables in .dev.vars as well - this causes the types to be properly generated

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
Projects
Status: Untriaged
Development

No branches or pull requests

1 participant