aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.12k forks source link

Not able to connect to graphql #8972

Closed DarkestMisery closed 3 years ago

DarkestMisery commented 3 years ago

Before opening, please confirm:

JavaScript Framework

Next.js

Amplify APIs

GraphQL API

Amplify Categories

api

Environment information

``` # Put output below this line System: OS: Linux 5.11 Ubuntu 20.04.3 LTS (Focal Fossa) CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz Memory: 582.07 MB / 15.52 GB Container: Yes Shell: 5.8 - /usr/bin/zsh Binaries: Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node npm: 7.16.0 - ~/.nvm/versions/node/v14.15.0/bin/npm Browsers: Chrome: 93.0.4577.63 Firefox: 91.0.2 npmPackages: @amcharts/amcharts4: ^4.10.20 => 4.10.20 @ampproject/toolbox-optimizer: undefined () @apollo/client: ^3.3.19 => 3.3.19 @apollo/client/cache: undefined () @apollo/client/core: undefined () @apollo/client/errors: undefined () @apollo/client/link/batch: undefined () @apollo/client/link/batch-http: undefined () @apollo/client/link/context: undefined () @apollo/client/link/core: undefined () @apollo/client/link/error: undefined () @apollo/client/link/http: undefined () @apollo/client/link/persisted-queries: undefined () @apollo/client/link/retry: undefined () @apollo/client/link/schema: undefined () @apollo/client/link/utils: undefined () @apollo/client/link/ws: undefined () @apollo/client/react: undefined () @apollo/client/react/components: undefined () @apollo/client/react/context: undefined () @apollo/client/react/data: undefined () @apollo/client/react/hoc: undefined () @apollo/client/react/hooks: undefined () @apollo/client/react/parser: undefined () @apollo/client/react/ssr: undefined () @apollo/client/testing: undefined () @apollo/client/utilities: undefined () @babel/core: undefined () @headlessui/react: ^1.2.0 => 1.2.0 @heroicons/react: ^1.0.1 => 1.0.1 amcharts4-example-100%-stacked-column-chart: 0.1.0 amcharts4-example-adding-live-data: 0.1.0 amcharts4-example-amcharts3: 0.1.0 amcharts4-example-animating-along-the-line-series: 0.1.0 amcharts4-example-bar-chart-race: 0.1.0 amcharts4-example-base: 0.1.0 amcharts4-example-bent-gantt-chart: 0.1.0 amcharts4-example-bubble-chart: 0.1.0 amcharts4-example-candlestick-chart: 0.1.0 amcharts4-example-changing-series-apppearance: 0.1.0 amcharts4-example-changing-tree-map-data: 0.1.0 amcharts4-example-chord-diagram: 0.1.0 amcharts4-example-chord-diagram-non-ribbon: 0.1.0 amcharts4-example-chord-friends-kisses: 0.1.0 amcharts4-example-clock: 0.1.0 amcharts4-example-column-chart-with-axis-break: 0.1.0 amcharts4-example-column-chart-with-images-as-bullets: 0.1.0 amcharts4-example-columns-with-pies-inside: 0.1.0 amcharts4-example-countries-morphing-to-pie-chart: 0.1.0 amcharts4-example-curved-column-chart: 0.1.0 amcharts4-example-custom-shape-chart: 0.1.0 amcharts4-example-cylinder-chart: 0.1.0 amcharts4-example-data-grouping-50K: 0.1.0 amcharts4-example-date-based-radar: 0.1.0 amcharts4-example-day-night-map: 0.1.0 amcharts4-example-donut-chart: 0.1.0 amcharts4-example-drag-and-change-values: 0.1.0 amcharts4-example-dragging-pie-slices: 0.1.0 amcharts4-example-drill-down-map: 0.1.0 amcharts4-example-drill-down-tree-map: 0.1.0 amcharts4-example-dumbbell-plot: 0.1.0 amcharts4-example-dumbbell-plot-horizontal: 0.1.0 amcharts4-example-duration-axis: 0.1.0 amcharts4-example-error-chart: 0.1.0 amcharts4-example-fill-between-lines-chart: 0.1.0 amcharts4-example-fishbone-timeline: 0.1.0 amcharts4-example-force-directed-creating-links: 0.1.0 amcharts4-example-force-directed-network: 0.1.0 amcharts4-example-force-directed-tree: 0.1.0 amcharts4-example-force-directed-tree-expandable: 0.1.0 amcharts4-example-funnel-chart: 0.1.0 amcharts4-example-funnel-chart-horizontal: 0.1.0 amcharts4-example-gantt-chart: 0.1.0 amcharts4-example-gauge-with-bands: 0.1.0 amcharts4-example-geo-heat-map: 0.1.0 amcharts4-example-heat-map: 0.1.0 amcharts4-example-heat-map-circles: 0.1.0 amcharts4-example-heat-map-radar: 0.1.0 amcharts4-example-horizontally-stacked-axes: 0.1.0 amcharts4-example-infinity-chart: 0.1.0 amcharts4-example-lazy-loading: 0.1.0 amcharts4-example-line-different-ups-downs: 0.1.0 amcharts4-example-map-line-gauge-mix: 0.1.0 amcharts4-example-morphing-countries: 0.1.0 amcharts4-example-multiple-axes-date-based-chart: 0.1.0 amcharts4-example-multiple-series-map-chart: 0.1.0 amcharts4-example-non-chart-usage: 0.1.0 amcharts4-example-ohlc-chart: 0.1.0 amcharts4-example-packed-circles: 0.1.0 amcharts4-example-pictorial-bar-chart: 0.1.0 amcharts4-example-pictorial-chart: 0.1.0 amcharts4-example-pictorial-stacked-chart: 0.1.0 amcharts4-example-pictorial-stacked-chart-horizontal: 0.1.0 amcharts4-example-polar-area-chart: 0.1.0 amcharts4-example-population-pyramid: 0.1.0 amcharts4-example-pyramid-chart: 0.1.0 amcharts4-example-radar-chart-with-axis-break: 0.1.0 amcharts4-example-radar-timeline-chart: 0.1.0 amcharts4-example-radial-bar-chart: 0.1.0 amcharts4-example-real-time-data-sorting: 0.1.0 amcharts4-example-road-chart: 0.1.0 amcharts4-example-rotating-globe: 0.1.0 amcharts4-example-rotating-globe-with-circles: 0.1.0 amcharts4-example-sankey-diagram-with-animated-bullets: 0.1.0 amcharts4-example-semi-circle-donut-chart: 0.1.0 amcharts4-example-serpentine-gantt-horizontal: 0.1.0 amcharts4-example-serpentine-step-line: 0.1.0 amcharts4-example-serpentine-timeline: 0.1.0 amcharts4-example-simple-3D-pie-chart: 0.1.0 amcharts4-example-simple-bar-chart: 0.1.0 amcharts4-example-simple-column-chart: 0.1.0 amcharts4-example-simple-gauge: 0.1.0 amcharts4-example-simple-line-chart: 0.1.0 amcharts4-example-simple-map-chart: 0.1.0 amcharts4-example-simple-pie-chart: 0.1.0 amcharts4-example-simple-radar-chart: 0.1.0 amcharts4-example-simple-sankey-diagram: 0.1.0 amcharts4-example-simple-tree-map: 0.1.0 amcharts4-example-spiral-bar-chart: 0.1.0 amcharts4-example-spiral-chart: 0.1.0 amcharts4-example-spiral-gantt-chart: 0.1.0 amcharts4-example-stacked-3D-column-chart: 0.1.0 amcharts4-example-stacked-area-radar-chart: 0.1.0 amcharts4-example-stacked-column-chart: 0.1.0 amcharts4-example-stadium-track-chart: 0.1.0 amcharts4-example-step-count-chart: 0.1.0 amcharts4-example-step-line-chart: 0.1.0 amcharts4-example-step-line-no-risers-chart: 0.1.0 amcharts4-example-stock-chart: 0.1.0 amcharts4-example-stock-comparing-values: 0.1.0 amcharts4-example-sunburst: 0.1.0 amcharts4-example-syncing-cursors-and-zoom: 0.1.0 amcharts4-example-timeline: 0.1.0 amcharts4-example-triangle-column-chart: 0.1.0 amcharts4-example-variable-angle-radar-chart: 0.1.0 amcharts4-example-variable-height-3D-pie-chart: 0.1.0 amcharts4-example-variable-radius-pie-chart: 0.1.0 amcharts4-example-venn-diagram: 0.1.0 amcharts4-example-venn-diagram-with-patterns: 0.1.0 amcharts4-example-vertical-sankey-diagram: 0.1.0 amcharts4-example-vertically-stacked-axes: 0.1.0 amcharts4-example-waterfall-chart: 0.1.0 amcharts4-example-word-cloud: 0.1.0 amcharts4-example-word-cloud-changing-data: 0.1.0 amcharts4-example-work-hours-map: 0.1.0 amcharts4-example-xy-error-chart: 0.1.0 amphtml-validator: undefined () arg: undefined () async-retry: undefined () async-sema: undefined () autoprefixer: ^10.2.5 => 10.2.5 aws-amplify: ^3.4.0 => 3.4.0 aws-appsync: ^4.0.3 => 4.0.3 aws-appsync-react: ^4.0.3 => 4.0.3 bfj: undefined () cacache: undefined () chart.js: ^2.9.4 => 2.9.4 ci-info: undefined () classnames: ^2.2.6 => 2.2.6 comment-json: undefined () compression: undefined () conf: undefined () content-type: undefined () cookie: undefined () css-loader: undefined () css.gg: ^2.0.0 => 2.0.0 debug: undefined () devalue: undefined () escape-string-regexp: undefined () file-loader: undefined () find-cache-dir: undefined () find-up: undefined () fresh: undefined () graphql-tag: ^2.12.4 => 2.12.4 gzip-size: undefined () http-proxy: undefined () ignore-loader: undefined () ini: ^1.3.5 => 1.3.8 inquirer: ^6.5.1 => 6.5.2 is-animated: undefined () is-docker: undefined () is-wsl: undefined () json5: undefined () jsonwebtoken: undefined () loader-utils: undefined () lodash.curry: undefined () lru-cache: undefined () mini-css-extract-plugin: undefined () nanoid: undefined () neo-async: undefined () next: ^10.2.3 => 10.2.3 next-transpile-modules: ^8.0.0 => 8.0.0 ora: undefined () postcss: ^8.2.14 => 8.2.14 (8.2.13, 6.0.23) postcss-flexbugs-fixes: undefined () postcss-loader: undefined () postcss-preset-env: undefined () postcss-scss: undefined () primeflex: 2.0.0 => 2.0.0 primeicons: ^4.1.0 => 4.1.0 primereact: ^6.3.2 => 6.3.2 react: 17.0.2 => 17.0.2 react-apollo: ^3.1.5 => 3.1.5 react-csv: ^2.0.3 => 2.0.3 react-datepicker: ^4.2.1 => 4.2.1 react-dom: 17.0.2 => 17.0.2 react-table: ^7.7.0 => 7.7.0 react-transition-group: ^4.4.1 => 4.4.1 (2.9.0) react-transition-group/CSSTransition: undefined () react-transition-group/ReplaceTransition: undefined () react-transition-group/SwitchTransition: undefined () react-transition-group/Transition: undefined () react-transition-group/TransitionGroup: undefined () react-transition-group/TransitionGroupContext: undefined () react-transition-group/config: undefined () recast: undefined () recharts: ^2.0.9 => 2.0.9 resolve-url-loader: undefined () sass-loader: undefined () schema-utils: undefined () semver: undefined () send: undefined () simple-line-chart: 0.0.0 source-map: undefined () string-hash: undefined () strip-ansi: undefined () tailwindcss: ^2.1.2 => 2.1.2 terser: undefined () text-table: undefined () unistore: undefined () web-vitals: undefined () webpack: undefined () webpack-sources: undefined () npmGlobalPackages: @aws-amplify/cli: 6.1.0 @feathersjs/cli: 4.4.3 npm: 7.16.0 sequelize-cli: 6.2.0 ```

Describe the bug

Hi, I am trying to connect to AppSync to do some queries in graphql. Some days before, I publish the project with Amplify and after that, AppSync just not response anymore, this problem has been so annoying that it had replicated in the localhost.

Expected behavior

Get the information from the graphql API

Reproduction steps

Just open the page when I want to shwo the info and the problem appears

Code Snippet

I am using an existing backend with cognito auth:

...

"aws_appsync_graphqlEndpoint": "https://xxxxxxxxxxxxxxxxxxx.appsync-api.us-east-1.amazonaws.com/graphql", "aws_appsync_region": "us-east-1", "aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS", "aws_appsync_apiKey": "null" ...

And, following the guide libraries, I am using the API to send the query and get the results:

Log output

- POST 500 error

xhr.js?b50d:177
POST https://xxxxxxxxxxxxxxx.appsync-api.us-east-1.amazonaws.com/graphql 500
  | dispatchXhrRequest | @ | xhr.js?b50d:177 -- | -- | -- | --   | xhrAdapter | @ | xhr.js?b50d:13   | dispatchRequest | @ | dispatchRequest.js?5270:52   | Promise.then (async) |   |     | request | @ | Axios.js?0a06:61   | wrap | @ | bind.js?1d2b:9   | RestClient._request | @ | RestClient.js?038d:404   | eval | @ | RestClient.js?038d:219   | step | @ | RestClient.js?038d:55   | eval | @ | RestClient.js?038d:36   | eval | @ | RestClient.js?038d:30   | __awaiter | @ | RestClient.js?038d:26   | RestClient.ajax | @ | RestClient.js?038d:134   | RestClient.post | @ | RestClient.js?038d:281   | eval | @ | GraphQLAPI.js?6b0a:353   | step | @ | GraphQLAPI.js?6b0a:43   | eval | @ | GraphQLAPI.js?6b0a:24   | fulfilled | @ | GraphQLAPI.js?6b0a:15   | Promise.then (async) |   |     | step | @ | GraphQLAPI.js?6b0a:17   | fulfilled | @ | GraphQLAPI.js?6b0a:15   | Promise.then (async) |   |     | step | @ | GraphQLAPI.js?6b0a:17   | eval | @ | GraphQLAPI.js?6b0a:18   | __awaiter | @ | GraphQLAPI.js?6b0a:14   | GraphQLAPIClass._graphql | @ | GraphQLAPI.js?6b0a:288   | GraphQLAPIClass.graphql | @ | GraphQLAPI.js?6b0a:276   | APIClass.graphql | @ | API.js?a030:207   | _callee$ | @ | AutoSellContext.js?f39e:35   | tryCatch | @ | runtime.js?96cf:63   | invoke | @ | runtime.js?96cf:293   | eval | @ | runtime.js?96cf:118   | asyncGeneratorStep | @ | asyncToGenerator.js?1da1:3   | _next | @ | asyncToGenerator.js?1da1:25   | eval | @ | asyncToGenerator.js?1da1:32   | eval | @ | asyncToGenerator.js?1da1:21   | getData | @ | AutoSellContext.js?f39e:30   | eval | @ | AutoSellContext.js?f39e:55   | invokePassiveEffectCreate | @ | react-dom.development.js?61bb:23487   | callCallback | @ | react-dom.development.js?61bb:3945   | invokeGuardedCallbackDev | @ | react-dom.development.js?61bb:3994   | invokeGuardedCallback | @ | react-dom.development.js?61bb:4056   | flushPassiveEffectsImpl | @ | react-dom.development.js?61bb:23574   | unstable_runWithPriority | @ | scheduler.development.js?3069:468   | runWithPriority$1 | @ | react-dom.development.js?61bb:11276   | flushPassiveEffects | @ | react-dom.development.js?61bb:23447   | eval | @ | react-dom.development.js?61bb:23324   | workLoop | @ | scheduler.development.js?3069:417   | flushWork | @ | scheduler.development.js?3069:390   | performWorkUntilDeadline | @ | scheduler.development.js?3069:157
- Promise error

asyncToGenerator.js?1da1:6
Uncaught (in promise)
  1. {data: {…}, errors: Array(1)}
    1. data:
    2. errors: Array(1)
      1. 0: GraphQLError
        1. message: "Request failed with status code 500"
        2. extensions: undefined
        3. locations: undefined
        4. nodes: undefined
        5. path: undefined
        6. positions: undefined
        7. source: undefined
        8. stack: "Error: Request failed with status code 500\n at createError (webpack-internal:///./node_modules/axios/lib/core/createError.js:16:15)\n at settle (webpack-internal:///./node_modules/axios/lib/core/settle.js:17:12)\n at XMLHttpRequest.handleLoad (webpack-internal:///./node_modules/axios/lib/adapters/xhr.js:62:7)"
      2. length: 1
  | asyncGeneratorStep | @ | asyncToGenerator.js?1da1:6 -- | -- | -- | --   | _throw | @ | asyncToGenerator.js?1da1:29   | Promise.then (async) |   |     | asyncGeneratorStep | @ | asyncToGenerator.js?1da1:13   | _next | @ | asyncToGenerator.js?1da1:25   | eval | @ | asyncToGenerator.js?1da1:32   | eval | @ | asyncToGenerator.js?1da1:21   | getData | @ | AutoSellContext.js?f39e:30   | eval | @ | AutoSellContext.js?f39e:55   | invokePassiveEffectCreate | @ | react-dom.development.js?61bb:23487   | callCallback | @ | react-dom.development.js?61bb:3945   | invokeGuardedCallbackDev | @ | react-dom.development.js?61bb:3994   | invokeGuardedCallback | @ | react-dom.development.js?61bb:4056   | flushPassiveEffectsImpl | @ | react-dom.development.js?61bb:23574   | unstable_runWithPriority | @ | scheduler.development.js?3069:468   | runWithPriority$1 | @ | react-dom.development.js?61bb:11276   | flushPassiveEffects | @ | react-dom.development.js?61bb:23447   | eval | @ | react-dom.development.js?61bb:23324   | workLoop | @ | scheduler.development.js?3069:417   | flushWork | @ | scheduler.development.js?3069:390   | performWorkUntilDeadline | @ | scheduler.development.js?3069:157

aws-exports.js

No response

Manual configuration

No response

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

No response

DarkestMisery commented 3 years ago

I found the error, the last time I did amplify pull and I build my project, for some reason, my cognito user pool changed.

Sorry for the issue, but I can hardly find it.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.