Skip to content

Wrangler produces deprecated code out of the box #9075

@blixt

Description

@blixt

Which Cloudflare product(s) does this pertain to?

Wrangler

What versions & operating system are you using?

Wranger v4.13.2

Please provide a link to a minimal reproduction

No response

Describe the Bug

I'm running into issues using Wrangler, and trying to reduce the surface area by creating a basic project, but I'm realizing even the most simple use of Wrangler produces deprecated code. This makes me confused as to how I'm even supposed to get started. Repro steps:

npx wrangler init -y .
Need to install the following packages:
[email protected]
Ok to proceed? (y) y


 ⛅️ wrangler 4.13.2
-------------------

Using npm as package manager.
🌀 Running `npm create cloudflare@^2.5.0 . -y -- --wrangler-defaults`...

> npx
> create-cloudflare . --wrangler-defaults


──────────────────────────────────────────────────────────────────────────────────────────────────────────
👋 Welcome to create-cloudflare v2.45.3!
🧡 Let's get started.
📊 Cloudflare collects telemetry about your usage of Create-Cloudflare.

Learn more at: https://github.com/cloudflare/workers-sdk/blob/main/packages/create-cloudflare/telemetry.md
──────────────────────────────────────────────────────────────────────────────────────────────────────────

╭ Create an application with Cloudflare Step 1 of 3
│
├ In which directory do you want to create your application?
│ dir ./.
│
├ What would you like to start with?
│ category Hello World example
│
├ Which template would you like to use?
│ type SSR / full-stack app
│
├ Which language do you want to use?
│ lang TypeScript
│
├ Copying template files
│ files copied to project directory
│
├ Updating name in `package.json`
│ updated `package.json`
│
├ Installing dependencies
│ installed via `npm install`
│
╰ Application created 

╭ Configuring your application for Cloudflare Step 2 of 3
│
├ Installing wrangler A command line tool for building Cloudflare Workers
│ installed via `npm install wrangler --save-dev`
│
├ Installing @cloudflare/workers-types
│ installed via npm
│
├ Adding latest types to `tsconfig.json`
│ added @cloudflare/workers-types/2023-07-01
│
├ Retrieving current workerd compatibility date
│ compatibility date 2025-04-27
│
├ Initializing git repo
│ initialized git
│
├ Committing new files
│ git commit
│
╰ Application configured 

╭ Deploy with Cloudflare Step 3 of 3
│
├ Do you want to deploy your application?
│ no deploy via `npm run deploy`
│
╰ Done 

────────────────────────────────────────────────────────────
🎉  SUCCESS  Application created successfully!

💻 Continue Developing
Start dev server: npm run start
Deploy: npm run deploy

📖 Explore Documentation
https://developers.cloudflare.com/workers

🐛 Report an Issue
https://github.com/cloudflare/workers-sdk/issues/new/choose

💬 Join our Community
https://discord.cloudflare.com
────────────────────────────────────────────────────────────


npx wrangler init -y .  8.30s user 3.02s system 44% cpu 25.651 total
npm run cf-typegen (or npx wrangler types)
> [email protected] cf-typegen
> wrangler types


 ⛅️ wrangler 4.13.2
-------------------

Generating project types...

declare namespace Cloudflare {
	interface Env {
		ASSETS: Fetcher;
	}
}
interface Env extends Cloudflare.Env {}

Generating runtime types...

Runtime types generated.

────────────────────────────────────────────────────────────
✨ Types written to worker-configuration.d.ts

Action required Migrate from @cloudflare/workers-types to generated runtime types
`wrangler types` now generates runtime types and supersedes @cloudflare/workers-types.
You should now uninstall @cloudflare/workers-types and remove it from your tsconfig.json.

Action required Install @types/node
Since you have the `nodejs_compat` flag, you should install Node.js types by running "npm i --save-dev @types/node".

📖 Read about runtime types
https://developers.cloudflare.com/workers/languages/typescript/#generate-types
📣 Remember to rerun 'wrangler types' after you change your wrangler.json file.

(Expand to see output)

Note the warnings produced:

Image

What am I supposed to do instead?

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't working

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions