Skip to content

Commit 1c2b346

Browse files
committed
Remove Cloudflare Service Worker mentions
1 parent a007bdb commit 1c2b346

File tree

1 file changed

+2
-57
lines changed

1 file changed

+2
-57
lines changed

src/content/docs/workers-ai/tutorials/build-a-voice-notes-app-with-auto-transcription.mdx

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ Create a new Worker project using the `c3` CLI with the `nuxt` framework preset.
3939

4040
<PackageManagers type="create" pkg="cloudflare@latest" args={"voice-notes --framework=nuxt --experimental"} />
4141

42-
:::note
43-
At the time of writing this tutorial, the `--experimental` flag above uses the `cloudflare` preset (with "Service Worker" syntax) to create the project. This allows the app to be built for, and deployed onto Cloudflare Workers.
44-
:::
45-
4642
### Install additional dependencies
4743

4844
Change into the newly created project directory
@@ -69,7 +65,7 @@ export default defineNuxtConfig({
6965

7066
### [Optional] Move to Nuxt 4 compatibility mode
7167

72-
Moving to compatibility mode ensures that your application remains forward-compatible with upcoming updates to Nuxt.
68+
Moving to Nuxt 4 compatibility mode ensures that your application remains forward-compatible with upcoming updates to Nuxt.
7369

7470
Create a new `app` folder in the project's root directory and move the `app.vue` file to it. Also, add the following to your `nuxt.config.ts` file:
7571

@@ -114,10 +110,6 @@ Once the `AI` binding has been configured, run the `cf-typegen` command to gener
114110

115111
<PackageManagers type="run" args="cf-typegen" />
116112

117-
:::caution
118-
Running the `cf-typegen` command might produce an error because the specified entry file (`main = "./dist/worker/index.js"`) does not exist yet. This file will only be created after you build the project. As a temporary workaround, you can comment out this line in `wrangler.toml`, run the `cf-typegen` command, and then uncomment it before building the project.
119-
:::
120-
121113
Create a transcribe `POST` endpoint by creating `transcribe.post.ts` file inside the `/server/api` directory.
122114

123115
```ts title="server/api/transcribe.post.ts"
@@ -1161,61 +1153,14 @@ The above code does the following:
11611153

11621154
## 8. Deploy the application
11631155

1164-
Since the D1 database currently only supports the "Module Worker" syntax, you will need to migrate your existing project from the "Service Worker" format to the ["Module Worker" format](/workers/reference/migrate-to-module-workers/#bindings-in-service-worker-format).
1165-
1166-
With `Nitro 2.10.0` (Nitro is the backend that Nuxt uses) this is a straightforward task. Update your `nuxt.config.ts` file and change the nitro preset to `cloudflare_module`.
1167-
1168-
```ts title="nuxt.config.ts" del={7} ins={8} {2}
1169-
export default defineNuxtConfig({
1170-
compatibilityDate: '2024-09-19', // must be this date, or after
1171-
1172-
// ...
1173-
1174-
nitro: {
1175-
preset: "./cloudflare-preset"
1176-
preset: 'cloudflare_module',
1177-
},
1178-
1179-
// ...
1180-
})
1181-
```
1182-
1183-
Update your `wrangler.toml` file and change the main project entry and assets directory settings. Below is the final `wrangler.toml` file after this change.
1184-
1185-
```toml title="wrangler.toml"
1186-
#:schema node_modules/wrangler/config-schema.json
1187-
name = "voice-notes"
1188-
compatibility_date = "2024-11-06"
1189-
main = "./.output/server/index.mjs"
1190-
assets = { directory = "./.output/public/", binding = "ASSETS" }
1191-
1192-
# Workers Logs
1193-
# Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
1194-
# Configuration: https://developers.cloudflare.com/workers/observability/logs/workers-logs/#enable-workers-logs
1195-
[observability]
1196-
enabled = true
1197-
1198-
[ai]
1199-
binding = "AI"
1200-
1201-
[[d1_databases]]
1202-
binding = "DB"
1203-
database_name = "<DB_NAME>"
1204-
database_id = "<DB_ID>"
1205-
1206-
[[r2_buckets]]
1207-
binding = "R2"
1208-
bucket_name = "<BUCKET_NAME>"
1209-
```
1210-
12111156
Now you are ready to deploy the project to a `.workers.dev` sub-domain by running the deploy command.
12121157

12131158
<PackageManagers type="run" args="deploy" />
12141159

12151160
You can preview your application at `<YOUR_WORKER>.<YOUR_SUBDOMAIN>.workers.dev`.
12161161

12171162
:::note
1218-
If you used `pnpm` as your package manager, and may face build errors like `"stdin" is not exported by "node_modules/.pnpm/[email protected]/node_modules/unenv/runtime/node/process/index.mjs"`. To resolve it, you can try hoisting your node modules with the [`shamefully-hoist-true`](https://pnpm.io/npmrc) option.
1163+
If you used `pnpm` as your package manager, you may face build errors like `"stdin" is not exported by "node_modules/.pnpm/[email protected]/node_modules/unenv/runtime/node/process/index.mjs"`. To resolve it, you can try hoisting your node modules with the [`shamefully-hoist-true`](https://pnpm.io/npmrc) option.
12191164
:::
12201165

12211166
## Conclusion

0 commit comments

Comments
 (0)