Git Product home page Git Product logo

Comments (3)

jspspike avatar jspspike commented on August 19, 2024

I don't think this is because of the colon in the url but the fact that you don't return anything in your event handler. If you modify your script to look like this

addEventListener('fetch', event => {
    console.log('hello world') 
    event.respondWith(new Response("Hello"));
})

I no longer get the 500 response.

Also generally its recommended to use module syntax over the service worker syntax you have above.

from miniflare.

Silviu-Marian avatar Silviu-Marian commented on August 19, 2024

@jspspike thanks for the quick reply

I misunderstood the cause.

if you put in wrangler.toml the routes below, you will see get the 500 error:

routes = [
  { "pattern" = "my.test.site.com/*", "zone_name" = "mysite.com" }
]

This produces the error:

TypeError: Fetch API cannot load: test:a
    at Object.fetch (entry.worker.js:1004:36)

For syntax, I need to stick to addEventListener for now because of webpack. It doens't preserve the default entrypoint with target: 'webworker'

from miniflare.

mrbbot avatar mrbbot commented on August 19, 2024

Hey! 👋 This should be fixed by #699, which will be included in the next release. Please note, Miniflare 3 now lives in the cloudflare/workers-sdk repo, and new releases will be published there.

from miniflare.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.