Cloudflare Worker not automatically created

Goal: Turn Cloudflare Pages project into a full stack application by adding Cloudflare Workers.

With Pages, you can now build full-stack applications by executing code on the Cloudflare network with help from Cloudflare Workers

Issue: A Cloudflare Worker is not automatically created after adding a functions folder.

To get started, create a /functions directory at the root of your project. Writing your Functions files in this directory will automatically generate a Worker with custom functionality at the predesignated routes.

Steps taken

1.) Create a Github repo with an index.html file, css and js folders
2.) Connect the Github repo to a new Cloudflare Pages project.
3.) Add folder in Github called “functions” at the root
4.) Commit the change

Result: No additional files are created in the functions folder.

Using a /functions directory will generate a routing table based on the files present in the directory.

You won’t see a worker created for functions. Functions are bundled with each Pages project.

1 Like

You already quoted the part that says you need to write the functions code yourself.

The file structure should automatically be created when I add a functions folder to my root directory. That did not happen within Github.

To get started, create a /functions directory at the root of your project.

Writing your Functions files in this directory will automatically generate a Worker with custom functionality at the predesignated routes.

I tried again using wrangler 2.0 on VS Code. It worked.