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

DELETE Address not working #125

Open
fxmb opened this issue Dec 10, 2024 · 1 comment
Open

DELETE Address not working #125

fxmb opened this issue Dec 10, 2024 · 1 comment
Assignees

Comments

@fxmb
Copy link

fxmb commented Dec 10, 2024

There seems to be an issue with the "DELETE customer address" from the profile section. I noticed this in the B2B starter. When using the SDK the route returns this:

error:   Requested fields [id, company, customer_id, first_name, last_name, address_1, address_2, city, province, postal_code, country_code, phone, metadata, created_at, updated_at] are not valid
MedusaError: Requested fields [id, company, customer_id, first_name, last_name, address_1, address_2, city, province, postal_code, country_code, phone, metadata, created_at, updated_at] are not valid
    at prepareListQuery (/path/to/node_modules/@medusajs/framework/src/http/utils/get-query-config.ts:179:11)
    at prepareRetrieveQuery (/path/to/node_modules/@medusajs/framework/src/http/utils/get-query-config.ts:245:45)
    at validateQuery (/path/to/node_modules/@medusajs/framework/src/http/utils/validate-query.ts:85:31)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  __isMedusaError: true,
  type: 'invalid_data',
  code: undefined,
  date: 2024-12-10T08:49:14.067Z
}

This is the request from the storefront:

export const deleteCustomerAddress = async (
  addressId: string
): Promise<void> => {
  await sdk.store.customer
    .deleteAddress(addressId, getAuthHeaders())
    .then(() => {
      revalidateTag("customer")
      return { success: true, error: null }
    })
    .catch((err) => {
      return { success: false, error: err.toString() }
    })
}

So some of the validator is probably not correct. Could it be that some of the customer_address fields are not part of or wrongly part of the default selects?

@VariableVic VariableVic self-assigned this Dec 17, 2024
@VariableVic
Copy link
Collaborator

Thanks for the report! I've created an internal ticket as this seems to be an issue with the customer address API, not this Starter. I'll keep you posted.

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

No branches or pull requests

2 participants