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: c3 scheduled worker template using JS throws The entry-point file at "src/index.ts" was not found #3913

Closed
foreseaz opened this issue Sep 8, 2023 · 5 comments · May be fixed by Laurry-gee/workers-ns#139
Labels
bug Something that isn't working c3 Relating to C3 (create-cloudflare) package

Comments

@foreseaz
Copy link
Member

foreseaz commented Sep 8, 2023

Which Cloudflare product(s) does this pertain to?

Wrangler core

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

3.7.0

What version of Node are you using?

v18.9.1

What operating system are you using?

Mac

Describe the Bug

When choose not using TS but JS to create a cron worker, the wrangler.toml entry point is still index.ts, which throw the following error.

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

 ⛅️ wrangler 3.7.0
------------------

✘ [ERROR] The entry-point file at "src/index.ts" was not found.


If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/iss
ues/new/choose

│
Error:
> [email protected] deploy
> wrangler deploy

 ⛅️ wrangler 3.7.0
------------------

✘ [ERROR] The entry-point file at "src/index.ts" was not found.

If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose

npm ERR! code 1
npm ERR! path /Users/chenxi/workspace
npm ERR! command failed
npm ERR! command sh -c -- create-cloudflare chenxi-dev-cron

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/chenxi/.npm/_logs/2023-09-08T07_20_17_391Z-debug-0.log

✘ [ERROR] Command failed with exit code 1: npm create cloudflare@2 -- chenxi-dev-cron
@foreseaz foreseaz added the bug Something that isn't working label Sep 8, 2023
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Sep 8, 2023
@admah admah added the c3 Relating to C3 (create-cloudflare) package label Sep 8, 2023
@admah admah changed the title 🐛 BUG: Wrangler create using JS throws The entry-point file at "src/index.ts" was not found 🐛 BUG: c3 scheduled worker template using JS throws The entry-point file at "src/index.ts" was not found Sep 8, 2023
@cba85
Copy link

cba85 commented Sep 29, 2023

Same bug with wrangler 3.10.1 on Mac Os Sonoma

wrangler init --from-dash ******
 ⛅️ wrangler 3.10.1
-------------------
Using npm as package manager.
▲ [WARNING] The `init --from-dash` command is no longer supported. Please use `npm create cloudflare@2 ****** -- --type pre-existing --existing-script ******` instead.

  The `init` command will be removed in a future version.


Running `npm create cloudflare@2 ****** -- --type pre-existing --existing-script ******`...

using create-cloudflare version 2.3.1

╭ Create an application with Cloudflare Step 1 of 3
│
├ In which directory do you want to create your application?
│ dir ./******
│
├ What type of application do you want to create?
│ type undefined
│
├ Do you want to use TypeScript?
│ no typescript
│
├ Copying files from "hello-world" template
│
├ Do you want to use TypeScript?
│ no typescript
│
├ Selecting Cloudflare account retrieving accounts
│ account ******'s Account
│
├ Downloading existing worker files
│ downloaded existing "******" worker files
│
├ Retrieving current workerd compatibility date
│ compatibility date 2023-09-22
│
├ Do you want to use git for version control?
│ yes git
│
╰ Application created

╭ Installing dependencies Step 2 of 3
│
├ Installing dependencies
│ installed via `npm install`
│
├ Committing new files
│ git commit
│
╰ Dependencies Installed

╭ Deploy with Cloudflare Step 3 of 3
│
├ Do you want to deploy your application?
│ yes deploy via `npm run deploy`
│
├ Logging into Cloudflare checking authentication status
│ logged in
│
├ Selecting Cloudflare account retrieving accounts
│ account ******'s Account
│
├ Deploying your application
│
> ******@0.0.0 deploy
> wrangler deploy

 ⛅️ wrangler 3.10.1
-------------------

✘ [ERROR] The entry-point file at "src/index.ts" was not found.


If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/is
sues/new/choose

│
Error:
> ******@0.0.0 deploy
> wrangler deploy

 ⛅️ wrangler 3.10.1
-------------------

✘ [ERROR] The entry-point file at "src/index.ts" was not found.


If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose

npm ERR! code 1
npm ERR! path /Users/clem/code
npm ERR! command failed
npm ERR! command sh -c create-cloudflare ****** --type pre-existing --existing-script ******

npm ERR! A complete log of this run can be found in: /Users/clem/.npm/_logs/2023-09-29T16_21_37_288Z-debug-0.log

✘ [ERROR] Command failed with exit code 1: npm create cloudflare@2 ****** -- --type pre-existing --existing-script ******


If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose

@cba85
Copy link

cba85 commented Sep 29, 2023

For a temporary fix, just say no on step 3 of 3 "Do you want to deploy your application?".
The app will be created without error.

But running npm run start will throw the same error about index.ts file missing.

So, in your project directory, replace "index.ts" by "index.js" in wrangler.toml file:

main = "src/index.js"

Now it works!

@admah
Copy link
Contributor

admah commented Oct 4, 2023

This has been fixed in #3916 but the new version hasn't been released yet.

@cba85
Copy link

cba85 commented Oct 6, 2023

This has been fixed in #3916 but the new version hasn't been released yet.

Thank you! Awesome work by the way 💪

@dario-piotrowicz
Copy link
Member

Closing this issue as it seems to have been resolved, I also just checked the latest C3 version (2.6.0) and it does generate a valid scheduled worker both when you choose ts and not

@foreseaz, @cba85 please feel free to reopen the issue/comment on it if you still experience the issue

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 c3 Relating to C3 (create-cloudflare) package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants