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

Breaking change introduced when upgrading from 6.6.5 to 6.6.6 #14051

Closed
3 tasks done
ffxsam opened this issue Dec 3, 2024 · 5 comments
Closed
3 tasks done

Breaking change introduced when upgrading from 6.6.5 to 6.6.6 #14051

ffxsam opened this issue Dec 3, 2024 · 5 comments
Labels
Build Related to build issues GraphQL Related to GraphQL API issues pending-maintainer-response Issue is pending a response from the Amplify team. question General question

Comments

@ffxsam
Copy link
Contributor

ffxsam commented Dec 3, 2024

Before opening, please confirm:

JavaScript Framework

Vue

Amplify APIs

GraphQL API

Amplify Version

v6

Amplify Categories

api

Backend

Other

Environment information

# Put output below this line
  System:
    OS: macOS 15.1.1
    CPU: (16) arm64 Apple M4 Max
    Memory: 12.32 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.11.0 - ~/.local/state/fnm_multishells/39794_1733242832960/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.9.0 - ~/.local/state/fnm_multishells/39794_1733242832960/bin/npm
    pnpm: 9.14.4 - /opt/homebrew/bin/pnpm
    bun: 1.1.38 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 131.0.6778.108
    Safari: 18.1.1
  npmPackages:
    @aws-amplify/api-graphql: ^4.4.1 => 4.4.1 
    @aws-amplify/geo: ^3.0.52 => 3.0.52 
    @aws-sdk/client-lambda: ^3.699.0 => 3.699.0 
    @aws-sdk/client-s3: ^3.705.0 => 3.705.0 
    @aws-sdk/lib-storage: ^3.705.0 => 3.705.0 
    @casl/ability: ^6.7.2 => 6.7.2 
    @casl/vue: ^2.2.2 => 2.2.2 
    @chargebee/chargebee-js-vue-wrapper: ^0.3.2 => 0.3.2 
    @codemirror/lang-html: ^6.4.9 => 6.4.9 
    @graphql-codegen/cli: 5.0.3 => 5.0.3 
    @graphql-codegen/client-preset: 4.4.0 => 4.4.0 
    @mdi/font: ^7.4.47 => 7.4.47 
    @pinia/testing: ^0.1.7 => 0.1.7 
    @playwright/test: ^1.49.0 => 1.49.0 
    @rushstack/eslint-patch: ^1.10.4 => 1.10.4 
    @sentry/tracing: ^7.114.0 => 7.114.0 
    @sentry/vite-plugin: ^2.22.6 => 2.22.6 
    @sentry/vue: ^8.42.0 => 8.42.0 
    @tanstack/vue-query: ^5.62.2 => 5.62.2 
    @tiptap/extension-link: ^2.10.3 => 2.10.3 
    @tiptap/extension-text-align: ^2.10.3 => 2.10.3 
    @tiptap/extension-underline: ^2.10.3 => 2.10.3 
    @tiptap/pm: ^2.10.3 => 2.10.3 
    @tiptap/starter-kit: ^2.10.3 => 2.10.3 
    @tiptap/vue-3: ^2.10.3 => 2.10.3 
    @tsconfig/node20: ^20.1.4 => 20.1.4 
    @types/braintree-web: ^3.96.15 => 3.96.15 
    @types/canvas-confetti: ^1.6.4 => 1.6.4 
    @types/js-beautify: ^1.14.3 => 1.14.3 
    @types/jsdom: ^21.1.7 => 21.1.7 
    @types/lodash-es: ^4.17.12 => 4.17.12 
    @types/lodash.merge: ^4.6.9 => 4.6.9 
    @types/node: ^20.17.9 => 20.17.9 
    @types/sortablejs: ^1.15.8 => 1.15.8 
    @types/uuid: ^10.0.0 => 10.0.0 
    @types/validator: ^13.12.2 => 13.12.2 
    @types/zxcvbn: ^4.4.5 => 4.4.5 
    @vitejs/plugin-vue: ^5.2.1 => 5.2.1 
    @vue/eslint-config-prettier: ^9.0.0 => 9.0.0 
    @vue/eslint-config-typescript: ^13.0.0 => 13.0.0 
    @vue/test-utils: ^2.4.6 => 2.4.6 
    @vue/tsconfig: ^0.5.1 => 0.5.1 
    @vuepic/vue-datepicker: ^9.0.3 => 9.0.3 
    aws-amplify: 6.6.6 => 6.6.6 
    axios: ^1.7.8 => 1.7.8 
    axios-retry: ^4.5.0 => 4.5.0 
    braintree-web: ^3.112.1 => 3.112.1 
    camelcase-keys: ^9.1.3 => 9.1.3 
    canvas-confetti: ^1.9.3 => 1.9.3 
    change-case: ^5.4.4 => 5.4.4 
    chart.js: ^4.4.7 => 4.4.7 
    codemirror: ^6.0.1 => 6.0.1 
    colord: ^2.9.3 => 2.9.3 
    date-fns: ^4.1.0 => 4.1.0 
    deep-object-diff: ^1.1.9 => 1.1.9 
    dotenv: ^16.4.7 => 16.4.7 
    eslint: ^8.57.1 => 8.57.1 
    eslint-plugin-vue: ^9.32.0 => 9.32.0 
    filesize: ^10.1.6 => 10.1.6 
    graphql: ^16.9.0 => 16.9.0 
    gridstack: ^10.3.1 => 10.3.1 
    hls.js: ^1.5.17 => 1.5.17 
    husky: ^9.1.7 => 9.1.7 
    immutable: 5.0.0-beta.4 => 5.0.0-beta.4 
    js-base64: ^3.7.7 => 3.7.7 
    js-beautify: ^1.15.1 => 1.15.1 
    jsdom: ^25.0.1 => 25.0.1 
    keycode: ^2.2.1 => 2.2.1 
    lint-staged: ^15.2.10 => 15.2.10 
    lodash-es: ^4.17.21 => 4.17.21 
    mitt: ^3.0.1 => 3.0.1 
    node-ray: ^2.1.2 => 2.1.2 
    npm-run-all: ^4.1.5 => 4.1.5 
    peaks.js: github:reelcrafter/peaks.js => 0.27.0 
    pinia: ^2.2.8 => 2.2.8 
    prettier: ^3.4.1 => 3.4.1 
    qr-code-styling: 1.8.4 => 1.8.4 
    rollup-plugin-visualizer: ^5.12.0 => 5.12.0 
    sass: 1.78.0 => 1.78.0 
    snakecase-keys: ^8.0.1 => 8.0.1 
    sortablejs: ^1.15.6 => 1.15.6 
    sortablejs-vue3: ^1.2.11 => 1.2.11 
    tinycolor2: ^1.6.0 => 1.6.0 
    typescript: ~5.6.3 => 5.6.3 
    uuid: ^10.0.0 => 10.0.0 
    vidstack: ^1.12.12 => 1.12.12 
    vite: ^5.4.11 => 5.4.11 
    vite-plugin-vuetify: ^2.0.4 => 2.0.4 
    vitest: 2.1.3 => 2.1.3 
    vue: ^3.5.13 => 3.5.13 
    vue-chartjs: ^5.3.2 => 5.3.2 
    vue-codemirror6: ^1.3.8 => 1.3.8 
    vue-router: ^4.5.0 => 4.5.0 
    vue-tsc: ^2.1.10 => 2.1.10 
    vue3-otp-input: ^0.5.21 => 0.5.21 
    vue3-smooth-dnd: ^0.0.6 => 0.0.6 
    vuetify: ^3.7.5 => 3.7.5 
    waveform-data: ^4.5.0 => 4.5.0 
    wavesurfer.js: ^7.8.10 => 7.8.10 
    zen-observable-ts: ^1.1.0 => 1.1.0 
    zxcvbn: ^4.4.2 => 4.4.2 
  npmGlobalPackages:
    corepack: 0.29.4
    npm: 10.9.0

Describe the bug

Since upgrading from aws-amplify 6.6.5 to 6.6.6, we're seeing warnings/errors that are breaking our application with no code changes on our end.

[WARN] 47:16.660 GraphQLAPI resolveConfig - The API configuration is missing. This is likely due to Amplify.configure() not being called prior to generateClient().

error-reporter.ts:14 NoValidAuthTokens: No federated jwt
Subscribe only available for AWS AppSync endpoint

Our Amplify.configure() call is called immediately in src/main.ts via an import:

import './init/amplify';

And that module calls Amplify.configure() in the global scope, not in any sort of closure.

Expected behavior

I wouldn't expect any breaking changes, since this is a patch release. I looked at the release notes and didn't see anything major.

Reproduction steps

Could not offer a repo without sharing our codebase.

Code Snippet

No response

Log output

// Put your logs below this line
// Nothing useful returned from debug mode

aws-exports.js

No response

Manual configuration

import { Amplify } from 'aws-amplify';
import { useAuthStore } from '@/stores/auth'; // even if this is commented out, the error still occurs

/* eslint-disable camelcase */
Amplify.configure(
  {
    API: {
      GraphQL: {
        endpoint: import.meta.env.VITE_GRAPHQL_ENDPOINT,
        defaultAuthMode: 'userPool',
        // graphql_headers: async () => ({
        //   Authorization: (await Auth.currentSession())
        //     .getIdToken()
        //     .getJwtToken(),
        // }),
      },
    },
    Auth: {
      Cognito: {
        identityPoolId: import.meta.env.VITE_AWS_IDENTITY_POOL_ID,
        userPoolId: import.meta.env.VITE_AWS_USER_POOL_ID,
        userPoolClientId: import.meta.env.VITE_AWS_USER_POOL_CLIENT_ID,
        allowGuestAccess: false,
        mfa: {
          status: 'optional',
          smsEnabled: false,
          totpEnabled: true,
        },
      },
    },
    Geo: {
      LocationService: {
        region: 'us-east-1',
        maps: {
          items: {
            'esri-dark-gray-map': {
              style: 'Default style',
            },
          },
          default: 'esri-dark-gray-map',
        },
        searchIndices: {
          items: ['here-index'],
          default: 'here-index',
        },
      },
    },
    Storage: {
      S3: {
        bucket: import.meta.env.VITE_UPLOAD_BUCKET,
        region: import.meta.env.VITE_AWS_REGION,
      },
    },
  },
  {
    API: {
      GraphQL: {
        headers: async () => {
          const auth = useAuthStore();
          const jwt = await auth.getIdToken();

          return {
            Authorization: jwt || 'rcPublicGQL',
          };
        },
      },
    },
  }
);
/* eslint-enable camelcase */

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

See below. Line 33 in main.ts is a call to use Vue Router, which happens long after we import ./init/amplify.

CleanShot 2024-12-03 at 15 55 32@2x

window.hmrReloadCount = 0;

import '@/utils/better-json-parse';
import './init/amplify';
import { createApp } from 'vue';
import { createPinia } from 'pinia';
import App from './App.vue';
import router from './router';
import './init/ray';
import { initSentry } from './init/sentry';
import './assets/main.scss';
import './assets/dark.scss';
import './assets/fonts.css';
import 'gridstack/dist/gridstack.min.css';
import 'gridstack/dist/gridstack-extra.min.css';
import Vuetify from './plugins/vuetify';
import './assets/md3-elevation.scss';
import {
  MutationCache,
  QueryCache,
  QueryClient,
  VueQueryPlugin,
} from '@tanstack/vue-query';
import { userSettingsPlugin } from './stores/plugins/user-settings-plugin';
import { useErrorReporter } from './shared/composables/error-reporter';

const pinia = createPinia();
const app = createApp(App);

const { reportError } = useErrorReporter();

pinia.use(userSettingsPlugin);
app.use(router);
app.use(pinia);
app.use(Vuetify);
app.use(VueQueryPlugin, {
  queryClient: new QueryClient({
    mutationCache: new MutationCache({
      onError: (error, _variables, _context, mutation) => {
        let handled = false;

        if (mutation.meta?.errorHandler) {
          handled = (mutation.meta.errorHandler as any)(error);
        }

        if (!handled && mutation.meta?.errorWhile) {
          const errorMsg = mutation.meta.errorWhile as string;

          reportError(error, { while: errorMsg });
        }
      },
    }),
    queryCache: new QueryCache({
      onError: (error, query) => {
        let handled = false;

        if (query.meta?.errorHandler) {
          handled = (query.meta.errorHandler as any)(error);
        }

        if (!handled && query.meta?.errorWhile) {
          const errorMsg = query.meta.errorWhile as string;

          reportError(error, { while: errorMsg });
        }
      },
    }),
  }),
});

if (import.meta.env.PROD) {
  initSentry(app);
}

app.mount('#app');

import.meta.hot?.on('vite:beforeUpdate', () => {
  window.hmrReloadCount++;
});
@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending a response from the Amplify team. labels Dec 3, 2024
@jjarvisp
Copy link
Member

jjarvisp commented Dec 3, 2024

Hey @ffxsam, thanks for raising this issue. We will investigate and follow up

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Dec 3, 2024
@jjarvisp
Copy link
Member

jjarvisp commented Dec 3, 2024

Hi @ffxsam, while we are investigating, can you try to clear your node_modules & lock file to ensure there are no competing installations of core dependencies causing this conflict?

@ffxsam
Copy link
Contributor Author

ffxsam commented Dec 3, 2024

Hey @jjarvisp! No such luck after removing node_modules and pnpm-lock.yaml, and rerunning pnpm i.

@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Dec 3, 2024
@HuiSF
Copy link
Member

HuiSF commented Dec 3, 2024

Looking at your environment details you have this:

@aws-amplify/api-graphql: ^4.4.1 => 4.4.1

I checked the deps tree of aws-amplify@6.6.6, it ultimately should install @aws-amplify/api-graphql@4.4.2. Forcing installing 4.4.1 may cause installing another version of the @aws-amplify/core package which make the dependencies out of sync so the configuration object may be missing.

Are you listing @aws-amplify/api-graphql as a direct dependency of your project? If so please remove it and let the aws-amplify package to handle its version.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Dec 3, 2024
@HuiSF HuiSF added question General question Build Related to build issues GraphQL Related to GraphQL API issues labels Dec 3, 2024
@github-actions github-actions bot removed the pending-triage Issue is pending triage label Dec 3, 2024
@ffxsam
Copy link
Contributor Author

ffxsam commented Dec 3, 2024

Ah! We were able to finally update this code:

import { generateClient } from 'aws-amplify/api';
import type {
  GraphQLResult,
  GraphQLSubscription,
} from '@aws-amplify/api-graphql';

because older versions of aws-amplify didn't seem to export those types. Now with the latest updates, we can just do:

import {
  generateClient,
  type GraphQLResult,
  type GraphQLSubscription,
} from 'aws-amplify/api';

Glad that was super easy! Thanks for your help!

@ffxsam ffxsam closed this as completed Dec 3, 2024
@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Related to build issues GraphQL Related to GraphQL API issues pending-maintainer-response Issue is pending a response from the Amplify team. question General question
Projects
None yet
Development

No branches or pull requests

3 participants