Skip to content

baseUrl, error in the client when enabling S3 provider #1

Closed
@Twathik

Description

@Twathik

hello
Congratulation for this excellent project, il really look forward to try it out in production

For now I'am testing it a little, and I have somme issues

first, I'am using Traefik for my test lab as a reverse proxy, How can I specify the baseUrl in the configuration, I did not find a way in the Docs

Second there is an error in the generated client when I enable minio

public uploadFiles = async (config: UploadConfig): Promise<Response<UploadResponse[]>> => {
		try {
			// pass only files
			for (const pair of config.formData.entries()) {
				if (!(pair[1] instanceof Blob)) {
					config.formData.delete(pair[0]);
				}
			}
			const params = this.queryString({
				wg_api_hash: this.applicationHash,
			});
			if (this.csrfToken === undefined) {
				const res = await fetch(this.baseURL + "/" + this.applicationPath + "/auth/cookie/csrf", {
					credentials: "include",
					mode: "cors",
				});
				this.csrfToken = await res.text();
			}
			const headers: Headers = {
				...this.extraHeaders,
				Accept: "application/json",
				"WG-SDK-Version": this.sdkVersion,
			};
			if (this.csrfToken) {
				headers["X-CSRF-Token"] = this.csrfToken;
			}
			const body = config.formData;
			const f = fetchConfig.method === "POST" ? fetch : this.fetch; // only use SingleFlight for Queries
			const data = await f(this.baseURL + "/" + this.applicationPath + "/s3/" + config.provider + "/upload" + params, {
				headers,
				body,
				method: "POST",
				signal: config.abortSignal,
				credentials: "include",
				mode: "cors",
			});
			return {
				status: "ok",
				body: data,
			};
		} catch (e: any) {
			return {
				status: "error",
				message: e,
			};
		}
	};
```

const f = fetchConfig.method === "POST" ? fetch : this.fetch; // only use SingleFlight for Queries

fetchConfig is not defined as it is not passed in uploadFiles args

Thank your 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions