Code Monkey home page Code Monkey logo

Comments (31)

tehmaestro avatar tehmaestro commented on July 18, 2024 5

Hey, turns out I was using ember-simple-auth version 2.1.0, which uses an older version of ember-fetch . I was able to fix the issue by upgrading ember-simple-auth

from ember-fetch.

RobbieTheWagner avatar RobbieTheWagner commented on July 18, 2024 3

All of my addons have started failing with Error: fetch is not defined - maybe your browser targets are not covering everything you need?. What's the workaround?

from ember-fetch.

tehmaestro avatar tehmaestro commented on July 18, 2024 2

I'm using ember-fetch 8.0.4 and still have this issue.

from ember-fetch.

mrloop avatar mrloop commented on July 18, 2024 1

If your using yarn add this to your package.json

"resolutions": {
  "whatwg-fetch": "3.3.1"
 }

Looks like new release 3.4.0 of whatwg-fetch breaks ember-fetch

from ember-fetch.

RobbieTheWagner avatar RobbieTheWagner commented on July 18, 2024 1

This addon docs PR is currently throwing the error ember-learn/ember-cli-addon-docs#495

from ember-fetch.

chancancode avatar chancancode commented on July 18, 2024 1

The tutorial builds are failing as well: https://github.com/ember-learn/super-rentals-tutorial/actions/runs/199896721

from ember-fetch.

iamareebjamal avatar iamareebjamal commented on July 18, 2024 1

Failing for 8.0.2 as well https://github.com/fossasia/open-event-frontend/pull/4732/files https://travis-ci.com/github/fossasia/open-event-frontend/builds/179380414

from ember-fetch.

rwjblue avatar rwjblue commented on July 18, 2024

Hmm, maybe this global:

(function (global) {

Is now conflicting with this?

https://github.com/github/fetch/blob/99b26818147a4288429fcd96421cf038dccbc1ac/fetch.js#L1-L4

from ember-fetch.

rwjblue avatar rwjblue commented on July 18, 2024

I did try to see if the tests here would fail with the latest versions of whatwg-fetch, and they do not (#548).

Does anyone have a reproduction?

from ember-fetch.

RobbieTheWagner avatar RobbieTheWagner commented on July 18, 2024

I can confirm adding this fixes the issue for addon docs:

"resolutions": {
  "whatwg-fetch": "3.3.1"
 }

Is there a fix we can add to ember-fetch so this is not necessary?

from ember-fetch.

rwjblue avatar rwjblue commented on July 18, 2024

Is there a fix we can add to ember-fetch so this is not necessary?

Definitely. Once we know what is actually wrong 😃

We need a repro, and ideally to make this addons test suite fail like what is happening for realz...

from ember-fetch.

cah-brian-gantzler avatar cah-brian-gantzler commented on July 18, 2024

https://github.com/bgantzler/fetch-app

Just a new application, install ember-fetch, create a controller and import fetch. Will fail when you run the app

from ember-fetch.

cah-brian-gantzler avatar cah-brian-gantzler commented on July 18, 2024

fails when you run the tests. They are the default blueprint tests unmodified

from ember-fetch.

cah-brian-gantzler avatar cah-brian-gantzler commented on July 18, 2024

Oh and I resolved to the failing version using

"resolutions": {
  "whatwg-fetch": "3.4.0"
 }

just in case cause I saw a merge of a yarn.lock rollback

from ember-fetch.

rwjblue avatar rwjblue commented on July 18, 2024

Just a new application, install ember-fetch, create a controller and import fetch. Will fail when you run the app

Hmm, why aren't our own tests failing here then (if that is all that is needed)?

from ember-fetch.

RobbieTheWagner avatar RobbieTheWagner commented on July 18, 2024

Just a new application, install ember-fetch, create a controller and import fetch. Will fail when you run the app

Hmm, why aren't our own tests failing here then (if that is all that is needed)?

@rwjblue perhaps importing fetch in tests does not do the same things as importing it in app code?

from ember-fetch.

RobbieTheWagner avatar RobbieTheWagner commented on July 18, 2024

Perhaps we should set this addon to explicitly use 3.3.1 until we have a fix?

from ember-fetch.

cah-brian-gantzler avatar cah-brian-gantzler commented on July 18, 2024

For the simple app I have created above, running the test ember t does fail on the controller

not ok 1 Chrome 84.0 - [145 ms] - Unit | Controller | application: it exists
    ---
        actual: >
            null
        stack: >
            Error: fetch is not defined - maybe your browser targets are not covering everything you need?
                at Module.callback (http://localhost:7357/assets/vendor.js:66720:13)
                at Module.exports (http://localhost:7357/assets/vendor.js:118:32)
                at Module._reify (http://localhost:7357/assets/vendor.js:155:59)
                at Module.reify (http://localhost:7357/assets/vendor.js:142:27)
                at Module.exports (http://localhost:7357/assets/vendor.js:116:10)
                at requireModule (http://localhost:7357/assets/vendor.js:39:18)
                at Class._extractDefaultExport (http://localhost:7357/assets/vendor.js:92885:20)
                at Class.resolveOther (http://localhost:7357/assets/vendor.js:92545:32)
                at Class.resolve (http://localhost:7357/assets/vendor.js:92608:25)
                at resolve (http://localhost:7357/assets/vendor.js:1884:36)
        message: >
            Died on test #1     at Object.<anonymous> (http://localhost:7357/assets/tests.js:15:21)
                at processModule (http://localhost:7357/assets/test-support.js:3894:16)
                at module$1 (http://localhost:7357/assets/test-support.js:3919:4)
                at Module.callback (http://localhost:7357/assets/tests.js:12:21)
                at Module.exports (http://localhost:7357/assets/vendor.js:118:32)
                at requireModule (http://localhost:7357/assets/vendor.js:39:18)
                at TestLoader.require (http://localhost:7357/assets/test-support.js:14364:9)
                at TestLoader.loadModules (http://localhost:7357/assets/test-support.js:14357:14): fetch is not defined - maybe your browser targets are not covering everything you need?
        negative: >
            false
        browser log: |
    ...
ok 2 Chrome 84.0 - [1 ms] - ember-qunit: Ember.onerror validation: Ember.onerror is functioning properly

1..2
# tests 2
# pass  1
# skip  0
# todo  0
# fail  1

from ember-fetch.

cah-brian-gantzler avatar cah-brian-gantzler commented on July 18, 2024

Oh im sorry. I think I know what you mean. You mean ONLY importing fetch in tests. Yes I believe you may be correct. If has something to do with the loader.

This is the initial post I made in discord help

Uncaught Error: fetch is not defined - maybe your browser targets are not covering everything you need?
    at Module.callback (ember-fetch.js:824)
    at Module.exports (loader.js:106)
    at Module._reify (loader.js:143)
    at Module.reify (loader.js:130)
    at Module.exports (loader.js:104)
    at Module._reify (loader.js:143)
    at Module.reify (loader.js:130)
    at Module.exports (loader.js:104)
    at requireModule (loader.js:27)
    at Class._extractDefaultExport (index.js:397)

from ember-fetch.

cah-brian-gantzler avatar cah-brian-gantzler commented on July 18, 2024

I dont know if this helps, but on the repo I posted https://github.com/bgantzler/fetch-app if you switch to the branch acceptance (I just created), the fetch is no longer in the app, so the app no longer fails. It is now only imported in an acceptance test. And it fails there.

from ember-fetch.

RobbieTheWagner avatar RobbieTheWagner commented on July 18, 2024

Hmm, I have no idea why it doesn't fail in tests in this repo then. I think we should likely set to 3.3.1 explicitly until someone can figure out the real fix. @rwjblue thoughts on putting that in as a temporary patch?

from ember-fetch.

cah-brian-gantzler avatar cah-brian-gantzler commented on July 18, 2024

During this addons test run, the ember-fetch in vendor doesnt have any code where the <%= moduleBody %> is suppose to be
image

When when I run during my apps controller test (master) there is
image

So yea, the test environments they are running in are different

from ember-fetch.

xg-wang avatar xg-wang commented on July 18, 2024

Created a PR for failing CI.
It seems the self -> global name change Rob mentioned broke ember-fetch

from ember-fetch.

RobbieTheWagner avatar RobbieTheWagner commented on July 18, 2024

Nice, thanks @xg-wang! Looking forward to having this merged 😃

from ember-fetch.

xg-wang avatar xg-wang commented on July 18, 2024

@rwwagner90 no problem! Just released https://www.npmjs.com/package/ember-fetch/v/8.0.2

from ember-fetch.

chancancode avatar chancancode commented on July 18, 2024

Tutorial build is fixed with #552 https://github.com/ember-learn/super-rentals-tutorial/actions/runs/201815359

from ember-fetch.

EugeniaZhang avatar EugeniaZhang commented on July 18, 2024

image
"resolutions": {
"whatwg-fetch": "3.4.0"
}
I use this did not resolved the question

from ember-fetch.

RobbieTheWagner avatar RobbieTheWagner commented on July 18, 2024

@EugeniaZhang that would not resolve the issue, as 3.4.0 is where the issue began. You would need:

"resolutions": {
  "whatwg-fetch": "3.3.1"
 }

However, version 8.0.2 of ember-fetch has a fix for this issue, so I would recommend updating to 8.0.2.

from ember-fetch.

RobbieTheWagner avatar RobbieTheWagner commented on July 18, 2024

@iamareebjamal maybe try yarn upgrade? If it's failing, something is likely still not using 8.0.2.

from ember-fetch.

xg-wang avatar xg-wang commented on July 18, 2024

@tehmaestro can you paste the output of yarn why whatwg-fetch to tell us what's the versions you're using?

from ember-fetch.

allthesignals avatar allthesignals commented on July 18, 2024

@tehmaestro can you paste the output of yarn why whatwg-fetch to tell us what's the versions you're using?

image

yarn why whatwg-fetch
yarn why v1.22.4
[1/4] 🤔 Why do we have the module "whatwg-fetch"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "[email protected]"
info Reasons this module exists

  • "pretender" depends on it
  • Hoisted from "pretender#whatwg-fetch"
  • Hoisted from "ember-fetch#whatwg-fetch"
  • Hoisted from "ember-simple-auth#ember-fetch#whatwg-fetch"
  • Hoisted from "ember-simple-auth-token#ember-fetch#whatwg-fetch"
    info Disk size without dependencies: "72KB"
    info Disk size with unique dependencies: "72KB"
    info Disk size with transitive dependencies: "72KB"
    info Number of shared dependencies: 0
    ✨ Done in 0.87s.

from ember-fetch.

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.