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

"Cannot read properties of undefined (reading 'match')" in API Gateway request when clock is in future #11677

Closed
3 tasks done
hisham opened this issue Jul 25, 2023 · 7 comments
Assignees
Labels
API Related to REST API issues bug Something isn't working Core Related to core Amplify issues

Comments

@hisham
Copy link

hisham commented Jul 25, 2023

Before opening, please confirm:

JavaScript Framework

Angular

Amplify APIs

REST API

Amplify Categories

api

Environment information

# Put output below this line
  System:
    OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 6800H with Radeon Graphics
    Memory: 6.58 GB / 7.36 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 16.20.0 - ~/.nvm/versions/node/v16.20.0/bin/node
    npm: 8.19.4 - ~/.nvm/versions/node/v16.20.0/bin/npm
  npmPackages:
    @angular-builders/custom-webpack: ^15.0.0 => 15.0.0
    @angular-devkit/build-angular: ^15.2.4 => 15.2.4
    @angular-eslint/builder: ^15.2.1 => 15.2.1
    @angular-eslint/eslint-plugin: ^15.2.1 => 15.2.1
    @angular-eslint/eslint-plugin-template: ^15.2.1 => 15.2.1
    @angular-eslint/schematics: ^15.2.1 => 15.2.1
    @angular-eslint/template-parser: ^15.2.1 => 15.2.1
    @angular/animations: ^15.2.4 => 15.2.4 (12.2.6)
    @angular/animations/browser:  undefined ()
    @angular/animations/browser/testing:  undefined ()
    @angular/cdk: ^15.2.4 => 15.2.4
    @angular/cli: ^15.2.4 => 15.2.4
    @angular/common: ^15.2.4 => 15.2.4 (12.2.6)
    @angular/common/http:  undefined ()
    @angular/common/http/testing:  undefined ()
    @angular/common/testing:  undefined ()
    @angular/common/upgrade:  undefined ()
    @angular/compiler: ^15.2.4 => 15.2.4 (12.2.6)
    @angular/compiler-cli: ^15.2.4 => 15.2.4
    @angular/compiler/testing:  undefined ()
    @angular/core: ^15.2.4 => 15.2.4 (12.2.6)
    @angular/core/testing:  undefined ()
    @angular/elements: ^15.2.4 => 15.2.4
    @angular/forms: ^15.2.4 => 15.2.4
    @angular/material: ^15.2.4 => 15.2.4
    @angular/platform-browser: ^15.2.4 => 15.2.4 (12.2.6)
    @angular/platform-browser-dynamic: ^15.2.4 => 15.2.4 (12.2.6)
    @angular/platform-browser-dynamic/testing:  undefined ()
    @angular/platform-browser/animations:  undefined ()
    @angular/platform-browser/testing:  undefined ()
    @angular/router: ^15.2.4 => 15.2.4 (12.2.6)
    @angular/router/testing:  undefined ()
    @angular/router/upgrade:  undefined ()
    @gammastream/scully-plugin-sitemap: ^1.0.7 => 1.0.7
    @ng-select/ng-option-highlight: 0.0.7 => 0.0.7
    @ng-select/ng-select: ^10.0.3 => 10.0.3
    @ngneat/until-destroy: ^9.2.2 => 9.2.2
    @scullyio/init: ^2.1.41 => 2.1.41
    @scullyio/ng-lib: ^2.1.41 => 2.1.41
    @scullyio/scully: ^2.1.41 => 2.1.41
    @scullyio/scully-plugin-critical-css: 2.1.41 => 2.1.41
    @scullyio/scully-plugin-puppeteer: ^2.1.41 => 2.1.41
    @sentry/angular-ivy: ^7.57.0 => 7.57.0
    @sentry/cli: ^2.9.0 => 2.9.0
    @types/applepayjs: ^3.0.1 => 3.0.1
    @types/cheerio: ^0.22.23 => 0.22.29
    @types/grecaptcha: ^3.0.4 => 3.0.4
    @types/imagemin: ^7.0.1 => 7.0.1
    @types/imagemin-gifsicle: ^7.0.0 => 7.0.0
    @types/imagemin-mozjpeg: ^8.0.0 => 8.0.0
    @types/imagemin-optipng: ^5.2.0 => 5.2.0
    @types/imagemin-svgo: ^9.0.0 => 9.0.1
    @types/jasmine: ~3.6.0 => 3.6.11
    @types/jasminewd2: ~2.0.3 => 2.0.9
    @types/js-beautify: ^1.13.1 => 1.13.1
    @types/jsdom: ^16.2.5 => 16.2.12
    @types/lodash-es: ^4.17.5 => 4.17.5
    @types/marked: ^1.2.0 => 1.2.2
    @types/node: 16.11.7 => 16.11.7
    @types/node-zendesk: ^2.0.9 => 2.0.11
    @types/vivus: ^0.4.4 => 0.4.4
    @types/which: ^2.0.1 => 2.0.1
    @typescript-eslint/eslint-plugin: ^5.36.2 => 5.44.0
    @typescript-eslint/parser: ^5.36.2 => 5.44.0 (3.10.1)
    angular-cc-library: ^3.1.0 => 3.1.0
    array-flat-polyfill: ^1.0.1 => 1.0.1
    aws-amplify: ^5.3.4 => 5.3.4
    axios: ^0.21.1 => 0.21.4 (0.26.0)
    body-parser: ^1.19.0 => 1.19.2 (1.20.0)
    cheerio: ^1.0.0-rc.3 => 1.0.0-rc.10 (0.22.0)
    commander: ^2.20.3 => 2.20.3 (9.5.0, 4.1.1, 7.2.0, 2.13.0, 6.2.1)
    document-register-element: ^1.7.2 => 1.14.10
    dotenv-webpack: ^8.0.1 => 8.0.1
    eslint: ^8.23.0 => 8.28.0 (7.32.0)
    eslint-config-prettier: ^8.3.0 => 8.3.0
    eslint-plugin-import: 2.25.2 => 2.25.2
    eslint-plugin-jsdoc: ^39.6.3 => 39.6.3
    eslint-plugin-prefer-arrow: latest => 1.2.3
    eslint-plugin-react: ^7.31.11 => 7.31.11
    fast-xml-parser: ^3.17.6 => 3.19.0 (4.2.5)
    file-saver: ^2.0.5 => 2.0.5
    folder-hash: ^3.3.0 => 3.3.3
    fractional: ^1.0.0 => 1.0.0
    front-matter: ^4.0.2 => 4.0.2
    fs-extra: ^9.0.0 => 9.1.0 (8.1.0, 10.1.0)
    image-size: ^0.9.7 => 0.9.7 (0.5.5, 1.0.2)
    imagemin: ^7.0.1 => 7.0.1
    imagemin-gifsicle: ^7.0.0 => 7.0.0
    imagemin-mozjpeg: ^9.0.0 => 9.0.0
    imagemin-optipng: ^8.0.0 => 8.0.0
    imagemin-svgo: ^9.0.0 => 9.0.0
    jasmine-core: ~4.5.0 => 4.5.0
    jasmine-spec-reporter: ~5.0.0 => 5.0.2
    js-beautify: ^1.13.0 => 1.14.0
    js-yaml-loader: ^1.2.2 => 1.2.2
    json_encode: ^0.1.0 => 0.1.0
    karma: ~6.3.4 => 6.3.4
    karma-chrome-launcher: ~3.1.0 => 3.1.0
    karma-coverage-istanbul-reporter: ~3.0.2 => 3.0.3
    karma-jasmine: ~5.1.0 => 5.1.0
    karma-jasmine-html-reporter: ^2.0.0 => 2.0.0
    libphonenumber-js: ^1.10.14 => 1.10.14
    libphonenumber-js/build:  undefined ()
    libphonenumber-js/core:  undefined ()
    libphonenumber-js/max:  undefined ()
    libphonenumber-js/max/metadata:  undefined ()
    libphonenumber-js/min:  undefined ()
    libphonenumber-js/min/metadata:  undefined ()
    libphonenumber-js/mobile:  undefined ()
    libphonenumber-js/mobile/examples:  undefined ()
    libphonenumber-js/mobile/metadata:  undefined ()
    lodash-es: ^4.17.15 => 4.17.21
    lodash.merge: ^4.6.2 => 4.6.2
    lodash.snakecase: ^4.1.1 => 4.1.1
    marked: ^1.2.5 => 1.2.9 (4.0.14)
    mdn-polyfills: ^5.20.0 => 5.20.0
    ng2-pdf-viewer: ^9.1.3 => 9.1.3
    ngx-build-plus: ^15.0.0 => 15.0.0
    ngx-webcam: ^0.4.1 => 0.4.1
    node-example:  1.0.0
    object.fromentries: ^2.0.5 => 2.0.6
    pluralize: ^8.0.0 => 8.0.0
    prettier-eslint: ^12.0.0 => 12.0.0
    prompt-sync: ^4.2.0 => 4.2.0
    protractor-example:  1.0.0
    rxjs: ~7.8.0 => 7.8.0 (6.6.7)
    rxjs/ajax:  undefined ()
    rxjs/fetch:  undefined ()
    rxjs/internal-compatibility:  undefined ()
    rxjs/operators:  undefined ()
    rxjs/testing:  undefined ()
    rxjs/webSocket:  undefined ()
    s-ago: ^2.2.0 => 2.2.0
    scully-plugin-minify-html: ^6.0.0 => 6.0.0
    stripe: ^8.169.0 => 8.169.0
    svg-inline-loader: ^0.8.2 => 0.8.2
    tmp: ^0.1.0 => 0.1.0 (0.2.1, 0.0.33)
    ts-node: ~8.3.0 => 8.3.0 (10.0.0)
    tslib: ^2.3.0 => 2.6.0 (1.14.1, 2.5.0)
    typescript: ~4.8.3 => 4.8.4 (5.0.2, 3.9.10)
    typescript-example:  1.0.0
    uuid: ^8.3.1 => 8.3.2 (3.4.0)
    vivus: ^0.4.6 => 0.4.6
    webpack-bundle-analyzer: ^4.4.2 => 4.4.2
    which: ^2.0.2 => 2.0.2 (3.0.0, 1.3.1)
    xmlbuilder: ^15.1.1 => 15.1.1
    yaml: ^1.10.2 => 1.10.2 (2.3.1)
    zone-mix:  undefined ()
    zone-node:  undefined ()
    zone-testing:  undefined ()
    zone.js: ~0.11.4 => 0.11.4
    zone.js/async-test:  undefined ()
    zone.js/async-test.min:  undefined ()
    zone.js/fake-async-test:  undefined ()
    zone.js/fake-async-test.min:  undefined ()
    zone.js/jasmine-patch:  undefined ()
    zone.js/jasmine-patch.min:  undefined ()
    zone.js/long-stack-trace-zone:  undefined ()
    zone.js/long-stack-trace-zone.min:  undefined ()
    zone.js/mocha-patch:  undefined ()
    zone.js/mocha-patch.min:  undefined ()
    zone.js/proxy:  undefined ()
    zone.js/proxy.min:  undefined ()
    zone.js/sync-test:  undefined ()
    zone.js/sync-test.min:  undefined ()
    zone.js/task-tracking:  undefined ()
    zone.js/task-tracking.min:  undefined ()
    zone.js/webapis-media-query:  undefined ()
    zone.js/webapis-media-query.min:  undefined ()
    zone.js/webapis-notification:  undefined ()
    zone.js/webapis-notification.min:  undefined ()
    zone.js/webapis-rtc-peer-connection:  undefined ()
    zone.js/webapis-rtc-peer-connection.min:  undefined ()
    zone.js/webapis-shadydom:  undefined ()
    zone.js/webapis-shadydom.min:  undefined ()
    zone.js/wtf:  undefined ()
    zone.js/wtf.min:  undefined ()
    zone.js/zone-bluebird:  undefined ()
    zone.js/zone-bluebird.min:  undefined ()
    zone.js/zone-error:  undefined ()
    zone.js/zone-error.min:  undefined ()
    zone.js/zone-legacy:  undefined ()
    zone.js/zone-legacy.min:  undefined ()
    zone.js/zone-patch-canvas:  undefined ()
    zone.js/zone-patch-canvas.min:  undefined ()
    zone.js/zone-patch-cordova:  undefined ()
    zone.js/zone-patch-cordova.min:  undefined ()
    zone.js/zone-patch-electron:  undefined ()
    zone.js/zone-patch-electron.min:  undefined ()
    zone.js/zone-patch-fetch:  undefined ()
    zone.js/zone-patch-fetch.min:  undefined ()
    zone.js/zone-patch-jsonp:  undefined ()
    zone.js/zone-patch-jsonp.min:  undefined ()
    zone.js/zone-patch-message-port:  undefined ()
    zone.js/zone-patch-message-port.min:  undefined ()
    zone.js/zone-patch-promise-test:  undefined ()
    zone.js/zone-patch-promise-test.min:  undefined ()
    zone.js/zone-patch-resize-observer:  undefined ()
    zone.js/zone-patch-resize-observer.min:  undefined ()
    zone.js/zone-patch-rxjs:  undefined ()
    zone.js/zone-patch-rxjs-fake-async:  undefined ()
    zone.js/zone-patch-rxjs-fake-async.min:  undefined ()
    zone.js/zone-patch-rxjs.min:  undefined ()
    zone.js/zone-patch-socket-io:  undefined ()
    zone.js/zone-patch-socket-io.min:  undefined ()
    zone.js/zone-patch-user-media:  undefined ()
    zone.js/zone-patch-user-media.min:  undefined ()
  npmGlobalPackages:
    @angular/cli: 15.2.8
    @aws-amplify/cli: 12.1.1
    @mdkonsult/essential-cli: 7.2.2
    corepack: 0.17.0
    npm: 8.19.4

Describe the bug

If user's clock is in future, user is unable to login and we get a Sentry error reported from aws-amplify lib "Cannot read properties of undefined (reading 'match')" in the DateUtils.getDateFromHeaderString function

Expected behavior

User should be able to login or amplify lib fails gracefully.

Reproduction steps

  1. Set your ccomputer clock in future
  2. Access an API Gateway endpoint (might need to have cognito auth behind it not sure)

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


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

See attached Sentry error.

TypeError_ Cannot read properties of undefined (reading 'match') — pixineers-inc — website - Google Chrome 2023-07-25 10 34 00

@hisham hisham added the pending-triage Issue is pending triage label Jul 25, 2023
@cwomack cwomack added the API Related to REST API issues label Jul 25, 2023
@chrisbonifacio chrisbonifacio added API-REST Core Related to core Amplify issues and removed API Related to REST API issues pending-triage Issue is pending triage labels Jul 31, 2023
@ffxsam
Copy link
Contributor

ffxsam commented Aug 1, 2023

@hisham I believe we're having this issue too, with unauthenticated users trying to make a public GraphQL call. It only happens to a small portion of users.

How did you figure out the timestamp was in the future? I'm not seeing any sort of timestamp logged in Sentry.

@AllanZhengYP AllanZhengYP removed their assignment Aug 1, 2023
@hisham
Copy link
Author

hisham commented Aug 2, 2023

Sentry at the top of the issue has a red box saying they had a problem processing the error, and if you click on it, it will say something like timestamp is in the future.

I ran into issues similar to this (but in different parts of the amplify-js lib) related to people's computer clocks being incorrect. (e.g. #9281).

@cwomack
Copy link
Member

cwomack commented Aug 2, 2023

@hisham, can you confirm if you started to see this error after upgrading to Amplify v5.2.5? And is the error only happening on browser (i.e. nothing on iOS or Android)?

@hisham
Copy link
Author

hisham commented Aug 2, 2023

windows user and 1 android. This is a web app so all in the browser. It seems the error started since I upgraded to 5.3.4 from 5.3.3 2 weeks ago.

CleanShot 2023-08-03 at 01 43 24@2x

@AllanZhengYP AllanZhengYP self-assigned this Aug 4, 2023
@cwomack
Copy link
Member

cwomack commented Aug 8, 2023

Related to #11675

@cwomack cwomack added the bug Something isn't working label Aug 8, 2023
@AllanZhengYP
Copy link
Member

Hi @hisham

I think the issue you are seeing might already be fixed in this PR: #11498. Can you update the library to the latest to confirm if you are still seeing this error?

@AllanZhengYP AllanZhengYP removed their assignment Aug 9, 2023
@cwomack cwomack self-assigned this Aug 9, 2023
@hisham
Copy link
Author

hisham commented Aug 21, 2023

yeah seems resolved, thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to REST API issues bug Something isn't working Core Related to core Amplify issues
Projects
None yet
Development

No branches or pull requests

5 participants