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

name attribute missing in FetchDevicesOutput #14178

Open
3 tasks done
mehrdad-shokri opened this issue Feb 2, 2025 · 1 comment
Open
3 tasks done

name attribute missing in FetchDevicesOutput #14178

mehrdad-shokri opened this issue Feb 2, 2025 · 1 comment
Assignees
Labels
Auth Related to Auth components/category question General question

Comments

@mehrdad-shokri
Copy link

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

api

Backend

CDK

Environment information

# Put output below this line


  System:
    OS: macOS 15.1.1
    CPU: (10) arm64 Apple M2 Pro
    Memory: 66.22 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
    bun: 1.1.45 - ~/.bun/bin/bun
  Browsers:
    Chrome: 132.0.6834.160
    Edge: 132.0.2957.127
    Safari: 18.1.1
  npmPackages:
    @ampproject/toolbox-optimizer:  undefined ()
    @aws-amplify/adapter-nextjs: ^1.4.0 => 1.4.2 
    @aws-amplify/adapter-nextjs/api:  undefined ()
    @aws-amplify/adapter-nextjs/data:  undefined ()
    @babel/core: ^7.23.0 => undefined (7.26.7, )
    @babel/runtime:  7.22.5 
    @edge-runtime/cookies:  5.0.0 
    @edge-runtime/ponyfill:  3.0.0 
    @edge-runtime/primitives:  5.0.0 
    @formatjs/cli: ^6.2.12 => 6.5.1 
    @formatjs/intl-localematcher: ^0.5.4 => 0.5.10 
    @hapi/accept:  undefined ()
    @hookform/resolvers: ^3.10.0 => 3.10.0 
    @hookform/resolvers/ajv:  1.0.0 
    @hookform/resolvers/arktype:  2.0.0 
    @hookform/resolvers/class-validator:  1.0.0 
    @hookform/resolvers/computed-types:  1.0.0 
    @hookform/resolvers/effect-ts:  1.0.0 
    @hookform/resolvers/fluentvalidation-ts:  1.0.0 
    @hookform/resolvers/io-ts:  1.0.0 
    @hookform/resolvers/joi:  1.0.0 
    @hookform/resolvers/nope:  1.0.0 
    @hookform/resolvers/superstruct:  1.0.0 
    @hookform/resolvers/typanion:  1.0.0 
    @hookform/resolvers/typebox:  1.0.0 
    @hookform/resolvers/typeschema:  1.0.0 
    @hookform/resolvers/valibot:  1.0.0 
    @hookform/resolvers/vest:  1.0.0 
    @hookform/resolvers/vine:  1.0.0 
    @hookform/resolvers/yup:  1.0.0 
    @hookform/resolvers/zod:  1.0.0 
    @ianvs/prettier-plugin-sort-imports: ^4.1.0 => 4.4.1 
    @mantine/carousel: ^7.12.0 => 7.16.2 
    @mantine/code-highlight: ^7.12.0 => 7.16.2 
    @mantine/core: ^7.12.0 => 7.16.2 
    @mantine/dates: ^7.12.0 => 7.16.2 
    @mantine/dropzone: ^7.12.0 => 7.16.2 
    @mantine/hooks: ^7.12.0 => 7.16.2 
    @mantine/modals: ^7.12.0 => 7.16.2 
    @mantine/notifications: ^7.12.0 => 7.16.2 
    @mantine/nprogress: ^7.12.0 => 7.16.2 
    @mantine/spotlight: ^7.12.0 => 7.16.2 
    @mantine/tiptap: ^7.12.0 => 7.16.2 
    @mswjs/interceptors:  undefined ()
    @napi-rs/triples:  undefined ()
    @next/bundle-analyzer: ^14.2.5 => 14.2.23 
    @next/eslint-plugin-next: ^13.5.4 => 13.5.8 
    @next/font:  undefined ()
    @next/third-parties: ^15.1.2 => 15.1.6 
    @opentelemetry/api:  undefined ()
    @radix-ui/react-checkbox: ^1.1.3 => 1.1.3 
    @radix-ui/react-dialog: ^1.1.4 => 1.1.5 
    @radix-ui/react-icons: ^1.3.2 => 1.3.2 
    @radix-ui/react-label: ^2.1.1 => 2.1.1 
    @radix-ui/react-scroll-area: ^1.2.2 => 1.2.2 
    @radix-ui/react-select: ^2.1.5 => 2.1.5 
    @radix-ui/react-separator: ^1.1.1 => 1.1.1 
    @radix-ui/react-slot: ^1.1.1 => 1.1.1 
    @radix-ui/react-toggle: ^1.1.1 => 1.1.1 
    @radix-ui/react-tooltip: ^1.1.6 => 1.1.7 
    @sentry/cli: ^2.33.1 => 2.41.1 (2.39.1)
    @sentry/nextjs: ^8.26.0 => 8.51.0 
    @storybook/addon-essentials: ^8.0.4 => 8.5.1 
    @storybook/addon-styling-webpack: ^1.0.0 => 1.0.1 
    @storybook/addon-themes: ^8.0.4 => 8.5.1 
    @storybook/blocks: ^8.0.4 => 8.5.1 
    @storybook/nextjs: ^8.0.4 => 8.5.1 
    @storybook/preview-api: ^8.0.4 => 8.5.1 
    @storybook/react: ^8.0.4 => 8.5.1 
    @tabler/icons-react: ^3.25.0 => 3.29.0 
    @tanstack/query-codemods:  undefined ()
    @tanstack/react-query: ^5.62.10 => 5.64.2 
    @testing-library/dom: ^9.3.3 => 9.3.4 (10.4.0)
    @testing-library/jest-dom: ^6.1.3 => 6.6.3 (6.5.0)
    @testing-library/react: ^14.0.0 => 14.3.1 
    @testing-library/user-event: ^14.5.1 => 14.6.1 (14.5.2)
    @theme-toggles/react: ^4.1.0 => 4.1.0 
    @tiptap/extension-link: ^2.5.9 => 2.11.3 
    @tiptap/react: ^2.5.9 => 2.11.3 
    @tiptap/starter-kit: ^2.5.9 => 2.11.3 
    @tsparticles/engine: ^3.7.1 => 3.8.0 
    @tsparticles/react: ^3.0.0 => 3.0.0 
    @tsparticles/slim: ^3.5.0 => 3.8.0 
    @types/jest: ^29.5.5 => 29.5.14 
    @types/negotiator: ^0.6.3 => 0.6.3 
    @types/node: ^20.12.7 => 20.17.16 
    @types/react: 18.3.2 => 18.3.2 
    @types/react-lottie: ^1.2.9 => 1.2.10 
    @types/react-syntax-highlighter: ^15.5.13 => 15.5.13 
    @typescript-eslint/eslint-plugin: ^7.2.0 => 7.18.0 
    @typescript-eslint/parser: ^7.2.0 => 7.18.0 
    @vercel/analytics: ^1.3.1 => 1.4.1 
    @vercel/nft:  undefined ()
    @vercel/og:  0.6.3 
    @vercel/speed-insights: ^1.1.0 => 1.1.0 
    acorn:  undefined ()
    amphtml-validator:  undefined ()
    animate.css: ^4.1.1 => 4.1.1 
    anser:  undefined ()
    arg:  undefined ()
    assert:  undefined ()
    async-retry:  undefined ()
    async-sema:  undefined ()
    autoprefixer: ^10.4.20 => 10.4.20 
    aws-amplify: ^6.12.0 => 6.12.2 
    aws-amplify/adapter-core:  undefined ()
    aws-amplify/analytics:  undefined ()
    aws-amplify/analytics/kinesis:  undefined ()
    aws-amplify/analytics/kinesis-firehose:  undefined ()
    aws-amplify/analytics/personalize:  undefined ()
    aws-amplify/analytics/pinpoint:  undefined ()
    aws-amplify/api:  undefined ()
    aws-amplify/api/server:  undefined ()
    aws-amplify/auth:  undefined ()
    aws-amplify/auth/cognito:  undefined ()
    aws-amplify/auth/cognito/server:  undefined ()
    aws-amplify/auth/enable-oauth-listener:  undefined ()
    aws-amplify/auth/server:  undefined ()
    aws-amplify/data:  undefined ()
    aws-amplify/data/server:  undefined ()
    aws-amplify/datastore:  undefined ()
    aws-amplify/in-app-messaging:  undefined ()
    aws-amplify/in-app-messaging/pinpoint:  undefined ()
    aws-amplify/push-notifications:  undefined ()
    aws-amplify/push-notifications/pinpoint:  undefined ()
    aws-amplify/storage:  undefined ()
    aws-amplify/storage/s3:  undefined ()
    aws-amplify/storage/s3/server:  undefined ()
    aws-amplify/storage/server:  undefined ()
    aws-amplify/utils:  undefined ()
    babel-loader: ^9.1.3 => 9.2.1 
    babel-packages:  undefined ()
    babel-plugin-formatjs: ^10.5.7 => 10.5.34 
    browserify-zlib:  undefined ()
    browserslist:  undefined ()
    buffer:  undefined ()
    bytes:  undefined ()
    ci-info:  undefined ()
    class-variance-authority: ^0.7.0 => 0.7.1 
    cli-select:  undefined ()
    client-only:  0.0.1 
    clsx: ^2.1.1 => 2.1.1 
    commander:  undefined ()
    comment-json:  undefined ()
    compression:  undefined ()
    conf:  undefined ()
    constants-browserify:  undefined ()
    constructs: ^10.3.0 => 10.4.2 
    content-disposition:  undefined ()
    content-type:  undefined ()
    cookie:  undefined ()
    cross-spawn:  undefined ()
    crypto-browserify:  undefined ()
    css.escape:  undefined ()
    data-uri-to-buffer:  undefined ()
    dayjs: ^1.11.12 => 1.11.13 
    debug:  undefined ()
    devalue:  undefined ()
    domain-browser:  undefined ()
    edge-runtime:  undefined ()
    eslint: ^8.51.0 => 8.57.1 
    eslint-config-airbnb: 19.0.4 => 19.0.4 
    eslint-config-airbnb-typescript: ^18.0.0 => 18.0.0 
    eslint-config-mantine: 3.2.0 => 3.2.0 
    eslint-config-prettier: ^9.0.0 => 9.1.0 
    eslint-plugin-import: ^2.28.1 => 2.31.0 
    eslint-plugin-jest: ^27.4.2 => 27.9.0 
    eslint-plugin-jsx-a11y: ^6.7.1 => 6.10.2 
    eslint-plugin-prettier: ^5.0.0 => 5.2.3 
    eslint-plugin-react: ^7.33.2 => 7.37.4 
    eslint-plugin-react-hooks: ^4.6.0 => 4.6.2 
    eslint-plugin-testing-library: ^6.0.2 => 6.5.0 
    eslint-plugin-unused-imports: ^3.0.0 => 3.2.0 
    events:  undefined ()
    examples:  0.1.0 
    find-cache-dir:  undefined ()
    find-up:  undefined ()
    firebase: ^10.12.5 => 10.14.1 
    firebase/analytics:  undefined ()
    firebase/app:  undefined ()
    firebase/app-check:  undefined ()
    firebase/auth:  undefined ()
    firebase/auth/cordova:  undefined ()
    firebase/auth/web-extension:  undefined ()
    firebase/compat:  undefined ()
    firebase/compat/analytics:  undefined ()
    firebase/compat/app:  undefined ()
    firebase/compat/app-check:  undefined ()
    firebase/compat/auth:  undefined ()
    firebase/compat/database:  undefined ()
    firebase/compat/firestore:  undefined ()
    firebase/compat/functions:  undefined ()
    firebase/compat/installations:  undefined ()
    firebase/compat/messaging:  undefined ()
    firebase/compat/performance:  undefined ()
    firebase/compat/remote-config:  undefined ()
    firebase/compat/storage:  undefined ()
    firebase/data-connect:  undefined ()
    firebase/database:  undefined ()
    firebase/firestore:  undefined ()
    firebase/firestore/lite:  undefined ()
    firebase/functions:  undefined ()
    firebase/installations:  undefined ()
    firebase/messaging:  undefined ()
    firebase/messaging/sw:  undefined ()
    firebase/performance:  undefined ()
    firebase/remote-config:  undefined ()
    firebase/storage:  undefined ()
    firebase/vertexai-preview:  undefined ()
    framer-motion: ^11.15.0 => 11.18.2 
    fresh:  undefined ()
    get-orientation:  undefined ()
    glob:  undefined ()
    gzip-size:  undefined ()
    hooks:  0.1.0 
    http-proxy:  undefined ()
    http-proxy-agent:  undefined ()
    https-browserify:  undefined ()
    https-proxy-agent:  undefined ()
    icss-utils:  undefined ()
    ignore-loader:  undefined ()
    image-size:  undefined ()
    input-otp: ^1.4.2 => 1.4.2 
    is-animated:  undefined ()
    is-docker:  undefined ()
    is-wsl:  undefined ()
    jest: ^29.7.0 => 29.7.0 
    jest-environment-jsdom: ^29.7.0 => 29.7.0 
    jest-websocket-mock: ^2.5.0 => 2.5.0 
    jest-worker:  undefined ()
    json5:  undefined ()
    jsonwebtoken:  undefined ()
    loader-runner:  undefined ()
    loader-utils:  undefined ()
    lodash.curry:  undefined ()
    lodash.isequal: ^4.5.0 => 4.5.0 
    lru-cache:  undefined ()
    lucide-react: ^0.447.0 => 0.447.0 
    mini-css-extract-plugin:  undefined ()
    mini-svg-data-uri: ^1.4.4 => 1.4.4 
    mongodb: ^6.8.0 => 6.12.0 
    mysql2: ^3.11.0 => 3.12.0 
    nanoid:  undefined ()
    native-url:  undefined ()
    negotiator: ^0.6.3 => 0.6.4 (1.0.0)
    neo-async:  undefined ()
    next: 14.2.18 => 14.2.18 
    next-intl: 3.26.3 => 3.26.3 
    next-themes: ^0.4.4 => 0.4.4 
    node-fetch:  undefined ()
    node-html-parser:  undefined ()
    ora:  undefined ()
    os-browserify:  undefined ()
    p-limit:  undefined ()
    path-browserify:  undefined ()
    picomatch:  undefined ()
    platform:  undefined ()
    postcss: ^8.4.47 => 8.5.1 (8.4.31, 8.4.38)
    postcss-flexbugs-fixes:  undefined ()
    postcss-modules-extract-imports:  undefined ()
    postcss-modules-local-by-default:  undefined ()
    postcss-modules-scope:  undefined ()
    postcss-modules-values:  undefined ()
    postcss-preset-env:  undefined ()
    postcss-preset-mantine: 1.17.0 => 1.17.0 
    postcss-safe-parser:  undefined ()
    postcss-scss:  undefined ()
    postcss-simple-vars: ^7.0.1 => 7.0.1 
    postcss-value-parser:  undefined ()
    prettier: ^3.0.3 => 3.4.2 
    process:  undefined ()
    punycode:  undefined ()
    querystring-es3:  undefined ()
    raw-body:  undefined ()
    react: 18.3.1 => 18.3.1 
    react-builtin:  undefined ()
    react-country-flag: ^3.1.0 => 3.1.0 
    react-day-picker: ^9.3.1 => 9.5.0 
    react-dom: 18.3.1 => 18.3.1 
    react-dom-builtin:  undefined ()
    react-dom-experimental-builtin:  undefined ()
    react-experimental-builtin:  undefined ()
    react-fast-marquee: ^1.6.5 => 1.6.5 
    react-google-recaptcha-v3: ^1.10.1 => 1.10.1 
    react-hook-form: ^7.54.2 => 7.54.2 
    react-icon-cloud: ^4.1.4 => 4.1.7 
    react-icons: ^5.2.1 => 5.4.0 
    react-infinite-scroll-hook: ^5.0.1 => 5.0.1 
    react-intersection-observer: ^9.13.0 => 9.15.1 
    react-is:  18.2.0 
    react-markdown: ^9.0.1 => 9.0.3 
    react-refresh:  0.12.0 
    react-server-dom-turbopack-builtin:  undefined ()
    react-server-dom-turbopack-experimental-builtin:  undefined ()
    react-server-dom-webpack-builtin:  undefined ()
    react-server-dom-webpack-experimental-builtin:  undefined ()
    react-syntax-highlighter: ^15.6.1 => 15.6.1 
    regenerator-runtime:  0.13.4 
    rehype-slug: ^6.0.0 => 6.0.0 
    remark-gfm: ^4.0.0 => 4.0.0 
    sass-loader:  undefined ()
    scheduler-builtin:  undefined ()
    scheduler-experimental-builtin:  undefined ()
    schema-utils:  undefined ()
    semver:  undefined ()
    send:  undefined ()
    server-only:  0.0.1 
    setimmediate:  undefined ()
    shell-quote:  undefined ()
    simplex-noise: ^4.0.3 => 4.0.3 
    sonner: ^1.7.1 => 1.7.2 
    source-map:  undefined ()
    source-map08:  undefined ()
    stacktrace-parser:  undefined ()
    storybook: ^8.0.4 => 8.5.1 
    storybook-dark-mode: ^4.0.1 => 4.0.2 
    stream-browserify:  undefined ()
    stream-http:  undefined ()
    string-hash:  undefined ()
    string_decoder:  undefined ()
    strip-ansi:  undefined ()
    stripe: ^16.7.0 => 16.12.0 
    styled-components: ^6.1.12 => 6.1.14 
    styled-components/native:  undefined ()
    superstruct:  undefined ()
    tailwind-merge: ^2.5.3 => 2.6.0 
    tailwindcss: ^3.4.12 => 3.4.17 
    tailwindcss-animate: ^1.0.7 => 1.0.7 
    tar:  undefined ()
    terser:  undefined ()
    text-table:  undefined ()
    timers-browserify:  undefined ()
    ts-jest: ^29.1.1 => 29.2.5 
    tty-browserify:  undefined ()
    typescript: ^5.5.4 => 5.7.3 
    typewriter-effect: ^2.21.0 => 2.21.0 
    ua-parser-js:  undefined ()
    unistore:  undefined ()
    util:  undefined ()
    uuid: ^10.0.0 => 10.0.0 (9.0.1)
    vm-browserify:  undefined ()
    watchpack:  undefined ()
    web-vitals:  undefined ()
    webpack:  undefined ()
    webpack-sources:  undefined ()
    ws:  undefined ()
    zod: ^3.24.1 => 3.24.1 ()
  npmGlobalPackages:
    aws-cdk: 2.177.0
    corepack: 0.25.2
    dpdm: 3.14.0
    madge: 7.0.0
    npm: 10.5.0

Describe the bug

calling fetchDevices from aws-amplify/auth has return type of: FetchDevicesOutput her is the related type declarations:

export type FetchDevicesOutput = AWSAuthDevice[];

export type AWSAuthDevice = AuthDevice & {
	attributes: AuthUserAttribute<UserAttributeKey>;
	createDate?: Date;
	lastAuthenticatedDate?: Date;
	lastModifiedDate?: Date;
};

export interface AuthDevice {
	id: string;
}

But when the call happens it returns devices with following keys:  ['id', 'name', 'attributes', 'createDate', 'lastModifiedDate', 'lastAuthenticatedDate']

Expected behavior

The type declarations should contain attribute name which it's value is something like: macOS 15.1.1 arm macOS Not A(Brand/8.0.0.0;Chromium/132.0.6834.160;Google Chrome/132.0.6834.160 This is a user friendly name to show user which device this logged in device refers to.
As you can see here the name attribute is returned from parseDevicesResponse(it has return type of FetchDevicesOutput = AWSAuthDevice[];) but the type of AWSAuthDevice doesn't have that attribute. This makes the IDE and compiler confused.
I can also make a pull request(with some assistant).

Reproduction steps

  1. call const devices = await fetchDevices()
  2. map the devices like devices.map(device => device?.name)
  3. Getting compiler issues

Code Snippet

// Put your code below this line.
(await fetchDevices()).map(device => device?.name)

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

No response

@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 Feb 2, 2025
@cwomack cwomack self-assigned this Feb 3, 2025
@cwomack cwomack added the Auth Related to Auth components/category label Feb 3, 2025
@cshfang
Copy link
Member

cshfang commented Feb 3, 2025

Hi @mehrdad-shokri. Thank you for reporting this, I will discuss with the team and get some background on this and investigate it more deeply.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Feb 3, 2025
@cwomack cwomack added question General question and removed pending-triage Issue is pending triage labels Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auth Related to Auth components/category question General question
Projects
None yet
Development

No branches or pull requests

3 participants