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

Fastboot Support is Soft Deprecated #8475

Closed
runspired opened this issue Mar 17, 2023 · 1 comment · Fixed by #8479 or redpencilio/fastboot-app-server-service#7
Closed

Fastboot Support is Soft Deprecated #8475

runspired opened this issue Mar 17, 2023 · 1 comment · Fixed by #8479 or redpencilio/fastboot-app-server-service#7

Comments

@runspired
Copy link
Contributor

runspired commented Mar 17, 2023

related: ember-fastboot/ember-cli-fastboot#913

Due to removal of the hack to load ember-fetch which is itself incompatible with modern ember and embroider, applications building with fastboot and using ember-data no longer have the ability to issue requests due to lacking APIs that should be available on the global.

ember-fetch support was removed in #8473
Fastboot request tests have been deactivated in #8472

As long as AbortController is unneeded and only legacy EmberData network fetching is used Fastboot will continue to work until removal of Adapter and Serializer codepaths in 6.0, which should occur ~ Fall 2023

This soft deprecations is because while EmberData is happy to continue testing against and supporting a healthy SSR project that enables use of ecosystem standards, we don't have time to maintain such an SSR solution ourselves.

@runspired
Copy link
Contributor Author

For using Fastboot with EmberData

<app>/config/fastboot.js

/* global ReadableStream, WritableStream, TransformStream */
module.exports = function (environment) {
  return {
    buildSandboxGlobals(defaultGlobals) {
      return Object.assign({}, defaultGlobals, {
        AbortController,
        ReadableStream:
          typeof ReadableStream !== 'undefined' ? ReadableStream : require('node:stream/web').ReadableStream,
        WritableStream:
          typeof WritableStream !== 'undefined' ? WritableStream : require('node:stream/web').WritableStream,
        TransformStream:
          typeof TransformStream !== 'undefined' ? TransformStream : require('node:stream/web').TransformStream,
        Headers: typeof Headers !== 'undefined' ? Headers : undefined,
      });
    },
  };
};

For using with ember-cli-fastboot-testing

config/fastboot-testing.js

/* global ReadableStream, WritableStream, TransformStream */
module.exports = {
  buildSandboxGlobals(defaultGlobals) {
    return Object.assign({}, defaultGlobals, {
      AbortController,
      ReadableStream:
        typeof ReadableStream !== 'undefined' ? ReadableStream : require('node:stream/web').ReadableStream,
      WritableStream:
        typeof WritableStream !== 'undefined' ? WritableStream : require('node:stream/web').WritableStream,
      TransformStream:
        typeof TransformStream !== 'undefined' ? TransformStream : require('node:stream/web').TransformStream,
      Headers: typeof Headers !== 'undefined' ? Headers : undefined,
    });
  },
};

Additionally global fetch will override EmberData's Fastboot.require('node-fetch') if present, so adding fetch to the sandbox "just works".

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