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

Import fetch from 'fetch' not working w/ 3.2.8 #55

Closed
BlueRaja opened this issue Jul 12, 2017 · 11 comments
Closed

Import fetch from 'fetch' not working w/ 3.2.8 #55

BlueRaja opened this issue Jul 12, 2017 · 11 comments

Comments

@BlueRaja
Copy link

Running ember-fetch in a Fastboot enabled app, we see the same issue mentioned in #26

Running without Fastboot works fine.

The project is huge so I'm not sure if this is a straight-up an ember-fetch issue, or a complex mix of other factors. We don't have any dependencies relying on ember-network.

@BlueRaja BlueRaja changed the title Import fetch from 'fetch' not working w/ 3.2.8 Import fetch from 'fetch' not working w/ 3.2.8 Jul 12, 2017
@kratiahuja
Copy link
Collaborator

@BlueRaja it would be great if you could provide a minimal reproduction of this issue.

@knownasilya
Copy link
Contributor

knownasilya commented Jul 15, 2017

I see something else, with 3.2.9, not sure if it's related. Also using ESA, but in an engine.

ember.debug.js:30911 Error while processing route: dashboard.index FastBoot is not defined ReferenceError: FastBoot is not defined
    at Module.callback (http://stocktonca.mg.dev/engines-dist/dashboard/ember-fetch/fastboot-fetch.js:3:17)
    at Module.exports (http://stocktonca.mg.dev/assets/vendor.js:4574:32)
    at Module._reify (http://stocktonca.mg.dev/assets/vendor.js:4609:59)
    at Module.reify (http://stocktonca.mg.dev/assets/vendor.js:4596:27)
    at Module.exports (http://stocktonca.mg.dev/assets/vendor.js:4572:10)
    at requireModule (http://stocktonca.mg.dev/assets/vendor.js:4498:18)
    at Class._extractDefaultExport (http://stocktonca.mg.dev/assets/vendor.js:214159:20)
    at Class.resolveOther (http://stocktonca.mg.dev/assets/vendor.js:213880:32)
    at Class.superWrapper [as resolveOther] (http://stocktonca.mg.dev/assets/vendor.js:64685:22)
    at Class.resolve (http://stocktonca.mg.dev/assets/vendor.js:29029:35)

@knownasilya
Copy link
Contributor

Looks like https://github.com/ember-cli/ember-fetch/blob/master/index.js#L84 targets vendor/* but the fastboot fetch was moved to public/

@kratiahuja
Copy link
Collaborator

@knownasilya That's the browser version which is wrapped with if (typeof FastBoot === 'undefined') {..} check. The Node version of fetch is present in the manifest here: https://github.com/ember-cli/ember-fetch/blob/master/index.js#L91. What's ESA?

From your stack trace it seems sandbox globals in FastBoot aren't being set. Can you put in a minimal reproduction? I would be happy to look into it.

@knownasilya
Copy link
Contributor

I'm not running Fastboot, that's the problem 😄 ESA is Ember Simple Auth, like #26 mentions might be related. But I think this is a different issue.

@sandydoo
Copy link

sandydoo commented Aug 8, 2017

Ran into this issue trying to move from ember-network on a pre-1.0 version of FastBoot. Quick review of what I found + solution:

b9be38f added support for the new v1.0 FastBoot (with the new manifest hook), but also completely removed support for legacy FastBoot by removing the conditional logic that injects the FastBoot shim into the FastBoot vendor tree. 😢

This means that if you're running an older version of ember-cli-fastboot, happily avoiding the breaking changes in some or all of your favourite addons, fetch won't be inserted into your FastBoot build. Should you need to stick to pre-1.0 for a while longer, one solution is to undo the deleted parts of that commit (verified it works) or just update ember-cli-fastboot to at leastv1.0.0-beta.18 (personally went with beta.19), which exposes the updateFastBootManifest hook to addons without breaking anything (in theory).

@samselikoff
Copy link

I ran into the same issue, the only way I could solve it was by having the host app install ember-fetch themselves (even though it's listed as a dependency in my addon).

Would a repro still help here?

@jkeen
Copy link

jkeen commented Aug 15, 2018

Also ran into this issue and got around it the same way Sam did above ^

@xg-wang
Copy link
Member

xg-wang commented Aug 20, 2018

@samselikoff @jkeen Can you verify the issue you have are duplicates of #98 or the pre-1.0 Fastboot one?

@samselikoff
Copy link

Seems like if the rule is for top-level app to have this installed, then this can be closed 👍

@xg-wang xg-wang closed this as completed Sep 7, 2018
@xg-wang
Copy link
Member

xg-wang commented Sep 7, 2018

If someone still sees this issue feel free to open another issue or comment to re-open.

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

7 participants