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

Undefined "uploadRemoteFile" when using RemoteSources #4791

Closed
2 tasks done
aanndryyyy opened this issue Nov 12, 2023 · 17 comments · Fixed by #4814
Closed
2 tasks done

Undefined "uploadRemoteFile" when using RemoteSources #4791

aanndryyyy opened this issue Nov 12, 2023 · 17 comments · Fixed by #4814
Assignees
Labels

Comments

@aanndryyyy
Copy link

Initial checklist

  • I understand this is a bug report and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Link to runnable example

No response

Steps to reproduce

I am using Svelte & SvelteKit with Uppy set up in an action:

const uppy = new Uppy({
	debug: process.env.NODE_ENV == 'development' ? true : false,
	restrictions: {
		allowedFileTypes: ['.pdf', '.docx'],
	},
	locale: $locale === 'et' ? Estonian : undefined,
});

function uploader(element: HTMLDivElement) {
	uppy.use(Transloadit, {
		assemblyOptions: {
			fields: {
				userId: userId,
				residenceId: residenceId,
			},
			params: {
				auth: { key: PUBLIC_TRANSLOADIT_API_KEY },
				template_id: PUBLIC_TRANSLOADIT_TEMPLATE_ID,
				notify_url: PUBLIC_API_BASE_URL,
			},
		},
	});

	uppy
		.use(Dashboard, {
			inline: true,
			target: element,
			fileManagerSelectionType: 'both',
			singleFileFullScreen: false,
		})
		.use(RemoteSources, {
			target: Dashboard,
			companionUrl: COMPANION_URL,
			companionAllowedHosts: COMPANION_ALLOWED_HOSTS,
			sources: ['GoogleDrive', 'OneDrive', 'Dropbox'],
		})
		.use(GoldenRetriever, { serviceWorker: true });
}
image image

I tried to revert to previous versions but still had the same issue. Current versions:

"@uppy/core": "^3.7.1",
"@uppy/dashboard": "^3.7.1",
"@uppy/golden-retriever": "^3.1.1",
"@uppy/remote-sources": "^1.1.0",
"@uppy/transloadit": "^3.4.0",
"@uppy/webcam": "^3.3.4",
"@uppy/xhr-upload": "^3.5.0",

before our app update yesterday (tried, the issue still persists):

"@uppy/core": "^3.6.1",
"@uppy/dashboard": "^3.6.0",
"@uppy/golden-retriever": "^3.1.1",
"@uppy/remote-sources": "^1.1.0",
"@uppy/transloadit": "^3.3.2",
"@uppy/webcam": "^3.3.4",
"@uppy/xhr-upload": "^3.4.2",

Expected behavior

Should upload files from Google or Dropbox.

Actual behavior

Console error and file is not uploaded.

[Uppy] [16:21:39] TypeError: can't access property "uploadRemoteFile", file.remote.requestClient is undefined

image
@arturi
Copy link
Contributor

arturi commented Nov 15, 2023

Hi! Sorry to hear you are facing this issues. Could you try removing the lock file and doing npm install or yarn install again? It is likely some dependency is stuck on a previous version.

@mifi
Copy link
Contributor

mifi commented Nov 22, 2023

we have tested latest version uppy and subdependencies and the problem does not exist. so the solution is to upgrade recursively all dependencies of uppy. closing this

@mifi mifi closed this as completed Nov 22, 2023
@StingNguyen
Copy link

Hello @mifi , I have same issue

@StingNguyen
Copy link

"@uppy/core": "^3.7.1",
"@uppy/dashboard": "^3.7.1",
"@uppy/drag-drop": "^3.0.3",
"@uppy/dropbox": "^3.1.4",
"@uppy/facebook": "^3.1.3",
"@uppy/file-input": "^3.0.4",
"@uppy/google-drive": "^3.3.0",
"@uppy/instagram": "^3.1.3",
"@uppy/onedrive": "^3.1.4",
"@uppy/progress-bar": "^3.0.4",
"@uppy/react": "^3.2.1",
"@uppy/transloadit": "^3.4.0",
"@uppy/url": "^3.4.0",
"@uppy/utils": "^5.6.0",

@RajuRajan
Copy link

RajuRajan commented Dec 6, 2023

@mifi, After upgrading also I have same issue.

Code:
https://codesandbox.io/p/sandbox/github-transloadi

Screenshot 2023-12-06 at 10 38 25 PM

@arturi
Copy link
Contributor

arturi commented Dec 7, 2023

Does it happen locally or only on Codesandbox? We think Codesandbox is resolving dependencies incorrectly.

What might help is adding @uppy/provider-views and @uppy/companion-client of latest versions to dependencies in package.json as well.

@mifi
Copy link
Contributor

mifi commented Dec 7, 2023

Upgrade all uppy dependencies recursively, or delete yarn.lock/package-lock.json if you don’t know how to do that.

@RajuRajan
Copy link

RajuRajan commented Dec 7, 2023

@mifi , We have tried upgrading uppy dependencies recursively. As u suggested, yarn lock file also deleted. We cross verified node_modules version as well. It is updated to latest version.

I'm experiencing the same in local setup, @arturi suggested to setup local because Codesandbox is resolving dependencies incorrectly.

Drive Link ( I have added package and yarn lock file)
https://drive.google.com/drive/folders/1HDxhXo6KUNfxmxv0QmXE9QvLPAW5WTQv?usp=sharing

Kindly check and tell us a work around at least.

@mifi
Copy link
Contributor

mifi commented Dec 7, 2023

Thanks for your detailed description. I see in your yarn.lock file that @uppy/[email protected] which is the latest version.

Can you double check inside node_modules/@uppy/provider-views/package.json that "version" is set to "3.7.0"?

also node_modules/@uppy/provider-views/lib/View.js that this line exists:

Object.defineProperty(tagFile.remote, 'requestClient', { value: this.provider, enumerable: false })

@RajuRajan
Copy link

Yes that line exists, added the file link below
https://drive.google.com/file/d/1qpLe9IJK0bjCqfOenAm1ASqos39lhFJ2/view?usp=sharing

Screenshot 2023-12-07 at 6 17 32 PM

@mifi
Copy link
Contributor

mifi commented Dec 7, 2023

this is very strange. I cannot reproduce this locally. Are you using your own companion server? Any chance that you could share a minimal reproducible example (without any of your secret keys)? or a codepen for example (codesandbox has problem with dependency resolution)

@RajuRajan
Copy link

We are using transloadit companion server.

@mifi
Copy link
Contributor

mifi commented Dec 7, 2023

ok! now i managed to reproduce the problem, thanks!

@mifi mifi reopened this Dec 7, 2023
@RajuRajan
Copy link

RajuRajan commented Dec 7, 2023

🥹

mifi added a commit that referenced this issue Dec 7, 2023
for some reason, only when testing locally using VITE_COMPANION_URL=https://api2.transloadit.com/companion only
we get this error...
i'm thinking for some reason, the remote file gets serialized into state and then de-serialized again
causing remote.requestClient to be gone
so I solve it by instead storing the request clients in Uppy

fixes #4791
@mifi
Copy link
Contributor

mifi commented Dec 7, 2023

created a pr #4814

@RajuRajan
Copy link

This issue is blocking us, kindly provide the update or any workaround if possible.

@mifi
Copy link
Contributor

mifi commented Dec 12, 2023

hi! hoping to merge that PR today

arturi pushed a commit that referenced this issue Dec 12, 2023
* fix uploadRemoteFile undefined

for some reason, only when testing locally using VITE_COMPANION_URL=https://api2.transloadit.com/companion only
we get this error...
i'm thinking for some reason, the remote file gets serialized into state and then de-serialized again
causing remote.requestClient to be gone
so I solve it by instead storing the request clients in Uppy

fixes #4791

* fix bugs

* remove unrelated space changes

* apply suggestions

* Update Uppy.js

* fix lint

---------

Co-authored-by: Antoine du Hamel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants