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

avoid the default is not a function unclear error #438

Conversation

dario-piotrowicz
Copy link
Member

@dario-piotrowicz dario-piotrowicz commented Aug 21, 2023

if there is some issue evaluating a lazy loaded edge function its default export ends up not being a function and that results in an unhelpful error like the following:

 TypeError: u.default is not a function

slightly improve the user experience by catching such error and letting the user know that something went wrong with the edge function's evaluation:

 Error: An error occurred while evaluating the target edge function (<edge-function-path>)

This should help slightly clarify errors such as the ones in #420

@changeset-bot
Copy link

changeset-bot bot commented Aug 21, 2023

🦋 Changeset detected

Latest commit: 8b53a9a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@cloudflare/next-on-pages Patch
eslint-plugin-next-on-pages Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Aug 21, 2023

🧪 Prereleases are available for testing 🧪

@cloudflare/next-on-pages

You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/5926945543/npm-package-next-on-pages-438

@cloudflare/eslint-plugin-next-on-pages

You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/5926945543/npm-package-eslint-plugin-next-on-pages-438

@dario-piotrowicz dario-piotrowicz force-pushed the avoid-default-is-not-a-function-error branch from b13ecd8 to 2724be3 Compare August 21, 2023 13:27
if there is some issue evaluating a lazy loaded edge function
its default export ends up not being a function and that results
in an unhelpful error like the following:
```
 TypeError: u.default is not a function
```

slightly improve the user experience by catching such error and
letting the user know that something went wrong with the edge
function's evaluation:
```
 Error: An error occurred while evaluating the target edge function (<edge-function-path>)
```
@dario-piotrowicz dario-piotrowicz force-pushed the avoid-default-is-not-a-function-error branch from 2724be3 to 8b53a9a Compare August 21, 2023 13:31
@dario-piotrowicz dario-piotrowicz merged commit cb32baf into cloudflare:main Aug 24, 2023
8 checks passed
@dario-piotrowicz dario-piotrowicz deleted the avoid-default-is-not-a-function-error branch August 24, 2023 16:36
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

Successfully merging this pull request may close these issues.

2 participants