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

TypeError: explorer.handle is not a function #2

Closed
clarencechien opened this issue Dec 8, 2022 · 2 comments
Closed

TypeError: explorer.handle is not a function #2

clarencechien opened this issue Dec 8, 2022 · 2 comments

Comments

@clarencechien
Copy link

clarencechien commented Dec 8, 2022

Hi, I follow the README to publish worker, but I got this error.
Is there a further manual or instruction to find out what's wrong?

note: wrangler 2.6.1
env: gitpod

@G4brym
Copy link
Owner

G4brym commented Dec 8, 2022

Hey @clarencechien
There was a bug in the npx r2-explorer command, and I've just fixed it

To fix your current project, you just need to go to the src/index.js file and replace the return explorer.handle with just return explorer. And it should look like this:

import { R2Explorer } from 'r2-explorer';

const explorer = R2Explorer({ readonly: true })

export default {
  async fetch(request, env, context) {
    return explorer(request, env, context)
  }
};

You should also update your r2-explorer version to the latest using this command npm install --save r2-explorer@latest

New users running the npx command shouldn't have this problem from now onwards.

Let me know if you have any other problems and thanks for reporting the issue 😄

@clarencechien
Copy link
Author

Hi @G4brym,

Thank you for quick response, this project is go great!
I follow your instruction, and now it works flawless.

I appreciate that you spent your time to work with this project.
Thank you so much for your generous sharing.
Have a nice day :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants