Skip to content

Inertia's axios instance not accessible #2715

@chasegiunta

Description

@chasegiunta

Inertia adapter(s) affected

  • React
  • Vue 3
  • Svelte
  • Not Applicable

JS package version

2.2.18

Backend stack (optional)

No response

Describe the problem

Reporting this as a bug, since Pascal may be under the impression that inertia is using the global axios instance, which is not the case.

Inertia is creating it's own instance, but not exporting that instance for consumers to use.

Even attempting to resolve axios packages to the exact same version will not guarantee that a global axios instance will be shared.

Thus far, I've used some brittle workarounds that involve my bundler pulling the axios dependency from the internal inertia node_modules folder, but it breaks from package manager to package manager, depending on duplicate dependency methodologies.

Steps to reproduce

  • Ensure there's only one version of axios installed in your project (via lockfile)
  • Import axios locally in your project
  • Attach an interceptor and modify the request somehow (maybe throw a debugger in there)
  • Submit a request and attempt to hit the debugger or observe modified request

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more info/workNeeds more info from the author or additional work to get merged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions